source: stylesheets/lfs-xsl/docbook-xsl-1.78.1/html/docbook.xsl@ 15c7d39

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 7.5 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 15c7d39 was 15c7d39, checked in by Matthew Burgess <matthew@…>, 11 years ago

Update stylesheets to docbook-xsl-1.78.1.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@10355 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 20.5 KB
Line 
1<?xml version='1.0'?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:ng="http://docbook.org/docbook-ng"
4 xmlns:db="http://docbook.org/ns/docbook"
5 xmlns:exsl="http://exslt.org/common"
6 xmlns:exslt="http://exslt.org/common"
7 exclude-result-prefixes="db ng exsl exslt"
8 version='1.0'>
9
10<xsl:output method="html"
11 encoding="ISO-8859-1"
12 indent="no"/>
13
14<!-- ********************************************************************
15 $Id: docbook.xsl 9605 2012-09-18 10:48:54Z tom_schr $
16 ********************************************************************
17
18 This file is part of the XSL DocBook Stylesheet distribution.
19 See ../README or http://docbook.sf.net/release/xsl/current/ for
20 copyright and other information.
21
22 ******************************************************************** -->
23
24<!-- ==================================================================== -->
25
26<xsl:include href="../VERSION.xsl"/>
27<xsl:include href="param.xsl"/>
28<xsl:include href="../lib/lib.xsl"/>
29<xsl:include href="../common/l10n.xsl"/>
30<xsl:include href="../common/common.xsl"/>
31<xsl:include href="../common/utility.xsl"/>
32<xsl:include href="../common/labels.xsl"/>
33<xsl:include href="../common/titles.xsl"/>
34<xsl:include href="../common/subtitles.xsl"/>
35<xsl:include href="../common/gentext.xsl"/>
36<xsl:include href="../common/targets.xsl"/>
37<xsl:include href="../common/olink.xsl"/>
38<xsl:include href="../common/pi.xsl"/>
39<xsl:include href="autotoc.xsl"/>
40<xsl:include href="autoidx.xsl"/>
41<xsl:include href="lists.xsl"/>
42<xsl:include href="callout.xsl"/>
43<xsl:include href="verbatim.xsl"/>
44<xsl:include href="graphics.xsl"/>
45<xsl:include href="xref.xsl"/>
46<xsl:include href="formal.xsl"/>
47<xsl:include href="table.xsl"/>
48<xsl:include href="htmltbl.xsl"/>
49<xsl:include href="sections.xsl"/>
50<xsl:include href="inline.xsl"/>
51<xsl:include href="footnote.xsl"/>
52<xsl:include href="html.xsl"/>
53<xsl:include href="info.xsl"/>
54<xsl:include href="keywords.xsl"/>
55<xsl:include href="division.xsl"/>
56<xsl:include href="toc.xsl"/>
57<xsl:include href="index.xsl"/>
58<xsl:include href="refentry.xsl"/>
59<xsl:include href="math.xsl"/>
60<xsl:include href="admon.xsl"/>
61<xsl:include href="component.xsl"/>
62<xsl:include href="biblio.xsl"/>
63<xsl:include href="biblio-iso690.xsl"/>
64<xsl:include href="glossary.xsl"/>
65<xsl:include href="block.xsl"/>
66<xsl:include href="task.xsl"/>
67<xsl:include href="qandaset.xsl"/>
68<xsl:include href="synop.xsl"/>
69<xsl:include href="titlepage.xsl"/>
70<xsl:include href="titlepage.templates.xsl"/>
71<xsl:include href="pi.xsl"/>
72<xsl:include href="ebnf.xsl"/>
73<xsl:include href="chunker.xsl"/>
74<xsl:include href="html-rtf.xsl"/>
75<xsl:include href="annotations.xsl"/>
76<xsl:include href="../common/stripns.xsl"/>
77
78<xsl:param name="stylesheet.result.type" select="'html'"/>
79<xsl:param name="htmlhelp.output" select="0"/>
80
81<!-- ==================================================================== -->
82
83<xsl:key name="id" match="*" use="@id|@xml:id"/>
84<xsl:key name="gid" match="*" use="generate-id()"/>
85
86<!-- ==================================================================== -->
87
88<xsl:template match="*">
89 <xsl:message>
90 <xsl:text>Element </xsl:text>
91 <xsl:value-of select="local-name(.)"/>
92 <xsl:text> in namespace '</xsl:text>
93 <xsl:value-of select="namespace-uri(.)"/>
94 <xsl:text>' encountered</xsl:text>
95 <xsl:if test="parent::*">
96 <xsl:text> in </xsl:text>
97 <xsl:value-of select="name(parent::*)"/>
98 </xsl:if>
99 <xsl:text>, but no template matches.</xsl:text>
100 </xsl:message>
101
102 <span style="color: red">
103 <xsl:text>&lt;</xsl:text>
104 <xsl:value-of select="name(.)"/>
105 <xsl:text>&gt;</xsl:text>
106 <xsl:apply-templates/>
107 <xsl:text>&lt;/</xsl:text>
108 <xsl:value-of select="name(.)"/>
109 <xsl:text>&gt;</xsl:text>
110 </span>
111</xsl:template>
112
113<xsl:template match="text()">
114 <xsl:value-of select="."/>
115</xsl:template>
116
117<xsl:template name="body.attributes">
118 <xsl:attribute name="bgcolor">white</xsl:attribute>
119 <xsl:attribute name="text">black</xsl:attribute>
120 <xsl:attribute name="link">#0000FF</xsl:attribute>
121 <xsl:attribute name="vlink">#840084</xsl:attribute>
122 <xsl:attribute name="alink">#0000FF</xsl:attribute>
123 <xsl:if test="starts-with($writing.mode, 'rl')">
124 <xsl:attribute name="dir">rtl</xsl:attribute>
125 </xsl:if>
126</xsl:template>
127
128<xsl:template name="head.content.base">
129 <xsl:param name="node" select="."/>
130 <base href="{$html.base}"/>
131</xsl:template>
132
133<xsl:template name="head.content.abstract">
134 <xsl:param name="node" select="."/>
135 <xsl:variable name="info" select="(articleinfo
136 |bookinfo
137 |prefaceinfo
138 |chapterinfo
139 |appendixinfo
140 |sectioninfo
141 |sect1info
142 |sect2info
143 |sect3info
144 |sect4info
145 |sect5info
146 |referenceinfo
147 |refentryinfo
148 |partinfo
149 |info
150 |docinfo)[1]"/>
151 <xsl:if test="$info and $info/abstract">
152 <meta name="description">
153 <xsl:attribute name="content">
154 <xsl:for-each select="$info/abstract[1]/*">
155 <xsl:value-of select="normalize-space(.)"/>
156 <xsl:if test="position() &lt; last()">
157 <xsl:text> </xsl:text>
158 </xsl:if>
159 </xsl:for-each>
160 </xsl:attribute>
161 </meta>
162 </xsl:if>
163</xsl:template>
164
165<xsl:template name="head.content.link.made">
166 <xsl:param name="node" select="."/>
167
168 <link rev="made" href="{$link.mailto.url}"/>
169</xsl:template>
170
171<xsl:template name="head.content.generator">
172 <xsl:param name="node" select="."/>
173 <meta name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/>
174</xsl:template>
175
176<xsl:template name="head.content.style">
177 <xsl:param name="node" select="."/>
178 <style type="text/css"><xsl:text>
179body { background-image: url('</xsl:text>
180<xsl:value-of select="$draft.watermark.image"/><xsl:text>');
181 background-repeat: no-repeat;
182 background-position: top left;
183 /* The following properties make the watermark "fixed" on the page. */
184 /* I think that's just a bit too distracting for the reader... */
185 /* background-attachment: fixed; */
186 /* background-position: center center; */
187 }</xsl:text>
188 </style>
189</xsl:template>
190
191<xsl:template name="head.content">
192 <xsl:param name="node" select="."/>
193 <xsl:param name="title">
194 <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
195 </xsl:param>
196
197 <xsl:call-template name="user.head.title">
198 <xsl:with-param name="title" select="$title"/>
199 <xsl:with-param name="node" select="$node"/>
200 </xsl:call-template>
201
202 <xsl:if test="$html.base != ''">
203 <xsl:call-template name="head.content.base">
204 <xsl:with-param name="node" select="$node"/>
205 </xsl:call-template>
206 </xsl:if>
207
208 <!-- Insert links to CSS files or insert literal style elements -->
209 <xsl:call-template name="generate.css"/>
210
211 <xsl:if test="$html.stylesheet != ''">
212 <xsl:call-template name="output.html.stylesheets">
213 <xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/>
214 </xsl:call-template>
215 </xsl:if>
216
217 <xsl:if test="$html.script != ''">
218 <xsl:call-template name="output.html.scripts">
219 <xsl:with-param name="scripts" select="normalize-space($html.script)"/>
220 </xsl:call-template>
221 </xsl:if>
222
223 <xsl:if test="$link.mailto.url != ''">
224 <xsl:call-template name="head.content.link.made">
225 <xsl:with-param name="node" select="$node"/>
226 </xsl:call-template>
227 </xsl:if>
228
229 <xsl:call-template name="head.content.generator">
230 <xsl:with-param name="node" select="$node"/>
231 </xsl:call-template>
232
233 <xsl:if test="$generate.meta.abstract != 0">
234 <xsl:call-template name="head.content.abstract">
235 <xsl:with-param name="node" select="$node"/>
236 </xsl:call-template>
237 </xsl:if>
238
239 <xsl:if test="($draft.mode = 'yes' or
240 ($draft.mode = 'maybe' and
241 ancestor-or-self::*[@status][1]/@status = 'draft'))
242 and $draft.watermark.image != ''">
243 <xsl:call-template name="head.content.style">
244 <xsl:with-param name="node" select="$node"/>
245 </xsl:call-template>
246 </xsl:if>
247 <xsl:apply-templates select="." mode="head.keywords.content"/>
248</xsl:template>
249
250<xsl:template name="output.html.stylesheets">
251 <xsl:param name="stylesheets" select="''"/>
252
253 <xsl:choose>
254 <xsl:when test="contains($stylesheets, ' ')">
255 <xsl:variable name="css.filename" select="substring-before($stylesheets, ' ')"/>
256
257 <xsl:call-template name="make.css.link">
258 <xsl:with-param name="css.filename" select="$css.filename"/>
259 </xsl:call-template>
260
261 <xsl:call-template name="output.html.stylesheets">
262 <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
263 </xsl:call-template>
264 </xsl:when>
265 <xsl:when test="$stylesheets != ''">
266 <xsl:call-template name="make.css.link">
267 <xsl:with-param name="css.filename" select="$stylesheets"/>
268 </xsl:call-template>
269 </xsl:when>
270 </xsl:choose>
271</xsl:template>
272
273<xsl:template name="output.html.scripts">
274 <xsl:param name="scripts" select="''"/>
275
276 <xsl:choose>
277 <xsl:when test="contains($scripts, ' ')">
278 <xsl:variable name="script.filename" select="substring-before($scripts, ' ')"/>
279
280 <xsl:call-template name="make.script.link">
281 <xsl:with-param name="script.filename" select="$script.filename"/>
282 </xsl:call-template>
283
284 <xsl:call-template name="output.html.scripts">
285 <xsl:with-param name="scripts" select="substring-after($scripts, ' ')"/>
286 </xsl:call-template>
287 </xsl:when>
288 <xsl:when test="$scripts != ''">
289 <xsl:call-template name="make.script.link">
290 <xsl:with-param name="script.filename" select="$scripts"/>
291 </xsl:call-template>
292 </xsl:when>
293 </xsl:choose>
294</xsl:template>
295
296<!-- ============================================================ -->
297
298<xsl:template match="*" mode="head.keywords.content">
299 <xsl:apply-templates select="chapterinfo/keywordset" mode="html.header"/>
300 <xsl:apply-templates select="appendixinfo/keywordset" mode="html.header"/>
301 <xsl:apply-templates select="prefaceinfo/keywordset" mode="html.header"/>
302 <xsl:apply-templates select="bookinfo/keywordset" mode="html.header"/>
303 <xsl:apply-templates select="setinfo/keywordset" mode="html.header"/>
304 <xsl:apply-templates select="articleinfo/keywordset" mode="html.header"/>
305 <xsl:apply-templates select="artheader/keywordset" mode="html.header"/>
306 <xsl:apply-templates select="sect1info/keywordset" mode="html.header"/>
307 <xsl:apply-templates select="sect2info/keywordset" mode="html.header"/>
308 <xsl:apply-templates select="sect3info/keywordset" mode="html.header"/>
309 <xsl:apply-templates select="sect4info/keywordset" mode="html.header"/>
310 <xsl:apply-templates select="sect5info/keywordset" mode="html.header"/>
311 <xsl:apply-templates select="sectioninfo/keywordset" mode="html.header"/>
312 <xsl:apply-templates select="refsect1info/keywordset" mode="html.header"/>
313 <xsl:apply-templates select="refsect2info/keywordset" mode="html.header"/>
314 <xsl:apply-templates select="refsect3info/keywordset" mode="html.header"/>
315 <xsl:apply-templates select="bibliographyinfo/keywordset" mode="html.header"/>
316 <xsl:apply-templates select="glossaryinfo/keywordset" mode="html.header"/>
317 <xsl:apply-templates select="indexinfo/keywordset" mode="html.header"/>
318 <xsl:apply-templates select="refentryinfo/keywordset" mode="html.header"/>
319 <xsl:apply-templates select="partinfo/keywordset" mode="html.header"/>
320 <xsl:apply-templates select="referenceinfo/keywordset" mode="html.header"/>
321 <xsl:apply-templates select="docinfo/keywordset" mode="html.header"/>
322 <xsl:apply-templates select="info/keywordset" mode="html.header"/>
323
324 <xsl:if test="$inherit.keywords != 0
325 and parent::*">
326 <xsl:apply-templates select="parent::*" mode="head.keywords.content"/>
327 </xsl:if>
328</xsl:template>
329
330<!-- ============================================================ -->
331
332<xsl:template name="system.head.content">
333 <xsl:param name="node" select="."/>
334
335 <!-- FIXME: When chunking, only the annotations actually used
336 in this chunk should be referenced. I don't think it
337 does any harm to reference them all, but it adds
338 unnecessary bloat to each chunk. -->
339 <xsl:if test="$annotation.support != 0 and //annotation">
340 <xsl:call-template name="add.annotation.links"/>
341 <script type="text/javascript">
342 <xsl:text>&#10;// Create PopupWindow objects</xsl:text>
343 <xsl:for-each select="//annotation">
344 <xsl:text>&#10;var popup_</xsl:text>
345 <xsl:value-of select="generate-id(.)"/>
346 <xsl:text> = new PopupWindow("popup-</xsl:text>
347 <xsl:value-of select="generate-id(.)"/>
348 <xsl:text>");&#10;</xsl:text>
349 <xsl:text>popup_</xsl:text>
350 <xsl:value-of select="generate-id(.)"/>
351 <xsl:text>.offsetY = 15;&#10;</xsl:text>
352 <xsl:text>popup_</xsl:text>
353 <xsl:value-of select="generate-id(.)"/>
354 <xsl:text>.autoHide();&#10;</xsl:text>
355 </xsl:for-each>
356 </script>
357
358 <style type="text/css">
359 <xsl:value-of select="$annotation.css"/>
360 </style>
361 </xsl:if>
362
363 <!-- system.head.content is like user.head.content, except that
364 it is called before head.content. This is important because it
365 means, for example, that <style> elements output by system.head.content
366 have a lower CSS precedence than the users stylesheet. -->
367</xsl:template>
368
369<!-- ============================================================ -->
370
371<xsl:template name="user.preroot">
372 <!-- Pre-root output, can be used to output comments and PIs. -->
373 <!-- This must not output any element content! -->
374</xsl:template>
375
376<xsl:template name="user.head.title">
377 <xsl:param name="node" select="."/>
378 <xsl:param name="title"/>
379
380 <title>
381 <xsl:copy-of select="$title"/>
382 </title>
383</xsl:template>
384
385<xsl:template name="user.head.content">
386 <xsl:param name="node" select="."/>
387</xsl:template>
388
389<xsl:template name="user.header.navigation">
390 <xsl:param name="node" select="."/>
391 <xsl:param name="prev" select="/foo"/>
392 <xsl:param name="next" select="/foo"/>
393 <xsl:param name="nav.context"/>
394</xsl:template>
395
396<xsl:template name="user.header.content">
397 <xsl:param name="node" select="."/>
398</xsl:template>
399
400<xsl:template name="user.footer.content">
401 <xsl:param name="node" select="."/>
402</xsl:template>
403
404<xsl:template name="user.footer.navigation">
405 <xsl:param name="node" select="."/>
406 <xsl:param name="prev" select="/foo"/>
407 <xsl:param name="next" select="/foo"/>
408 <xsl:param name="nav.context"/>
409</xsl:template>
410
411<!-- To use the same stripped nodeset everywhere, it should
412be created as a global variable here.
413Used by docbook.xsl, chunk-code.xsl and chunkfast.xsl -->
414<xsl:variable name="no.namespace">
415 <xsl:if test="$exsl.node.set.available != 0
416 and (*/self::ng:* or */self::db:*)">
417 <xsl:apply-templates select="/*" mode="stripNS"/>
418 </xsl:if>
419</xsl:variable>
420
421<xsl:template match="/">
422 <!-- * Get a title for current doc so that we let the user -->
423 <!-- * know what document we are processing at this point. -->
424 <xsl:variable name="doc.title">
425 <xsl:call-template name="get.doc.title"/>
426 </xsl:variable>
427 <xsl:choose>
428 <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
429 toss the namespace and continue. Use the docbook5 namespaced
430 stylesheets for DocBook5 if you don't want to use this feature.-->
431 <!-- include extra test for Xalan quirk -->
432 <xsl:when test="$exsl.node.set.available != 0
433 and (*/self::ng:* or */self::db:*)">
434 <xsl:call-template name="log.message">
435 <xsl:with-param name="level">Note</xsl:with-param>
436 <xsl:with-param name="source" select="$doc.title"/>
437 <xsl:with-param name="context-desc">
438 <xsl:text>namesp. cut</xsl:text>
439 </xsl:with-param>
440 <xsl:with-param name="message">
441 <xsl:text>stripped namespace before processing</xsl:text>
442 </xsl:with-param>
443 </xsl:call-template>
444 <!-- DEBUG: to save stripped document.
445 <xsl:message>Saving stripped document.</xsl:message>
446 <xsl:call-template name="write.chunk">
447 <xsl:with-param name="filename" select="'/tmp/stripped.xml'"/>
448 <xsl:with-param name="method" select="'xml'"/>
449 <xsl:with-param name="content">
450 <xsl:copy-of select="exsl:node-set($no.namespace)"/>
451 </xsl:with-param>
452 </xsl:call-template>
453 -->
454 <xsl:call-template name="log.message">
455 <xsl:with-param name="level">Note</xsl:with-param>
456 <xsl:with-param name="source" select="$doc.title"/>
457 <xsl:with-param name="context-desc">
458 <xsl:text>namesp. cut</xsl:text>
459 </xsl:with-param>
460 <xsl:with-param name="message">
461 <xsl:text>processing stripped document</xsl:text>
462 </xsl:with-param>
463 </xsl:call-template>
464 <xsl:apply-templates select="exsl:node-set($no.namespace)"/>
465 </xsl:when>
466 <!-- Can't process unless namespace removed -->
467 <xsl:when test="*/self::ng:* or */self::db:*">
468 <xsl:message terminate="yes">
469 <xsl:text>Unable to strip the namespace from DB5 document,</xsl:text>
470 <xsl:text> cannot proceed.</xsl:text>
471 </xsl:message>
472 </xsl:when>
473 <xsl:otherwise>
474 <xsl:choose>
475 <xsl:when test="$rootid != ''">
476 <xsl:choose>
477 <xsl:when test="count(key('id',$rootid)) = 0">
478 <xsl:message terminate="yes">
479 <xsl:text>ID '</xsl:text>
480 <xsl:value-of select="$rootid"/>
481 <xsl:text>' not found in document.</xsl:text>
482 </xsl:message>
483 </xsl:when>
484 <xsl:otherwise>
485 <xsl:if test="$collect.xref.targets = 'yes' or
486 $collect.xref.targets = 'only'">
487 <xsl:apply-templates select="key('id', $rootid)"
488 mode="collect.targets"/>
489 </xsl:if>
490 <xsl:if test="$collect.xref.targets != 'only'">
491 <xsl:apply-templates select="key('id',$rootid)"
492 mode="process.root"/>
493 <xsl:if test="$tex.math.in.alt != ''">
494 <xsl:apply-templates select="key('id',$rootid)"
495 mode="collect.tex.math"/>
496 </xsl:if>
497 </xsl:if>
498 </xsl:otherwise>
499 </xsl:choose>
500 </xsl:when>
501 <xsl:otherwise>
502 <xsl:if test="$collect.xref.targets = 'yes' or
503 $collect.xref.targets = 'only'">
504 <xsl:apply-templates select="/" mode="collect.targets"/>
505 </xsl:if>
506 <xsl:if test="$collect.xref.targets != 'only'">
507 <xsl:apply-templates select="/" mode="process.root"/>
508 <xsl:if test="$tex.math.in.alt != ''">
509 <xsl:apply-templates select="/" mode="collect.tex.math"/>
510 </xsl:if>
511 </xsl:if>
512 </xsl:otherwise>
513 </xsl:choose>
514 </xsl:otherwise>
515 </xsl:choose>
516</xsl:template>
517
518<xsl:template match="*" mode="process.root">
519 <xsl:variable name="doc" select="self::*"/>
520
521 <xsl:call-template name="user.preroot"/>
522 <xsl:call-template name="root.messages"/>
523
524 <html>
525 <xsl:call-template name="root.attributes"/>
526 <head>
527 <xsl:call-template name="system.head.content">
528 <xsl:with-param name="node" select="$doc"/>
529 </xsl:call-template>
530 <xsl:call-template name="head.content">
531 <xsl:with-param name="node" select="$doc"/>
532 </xsl:call-template>
533 <xsl:call-template name="user.head.content">
534 <xsl:with-param name="node" select="$doc"/>
535 </xsl:call-template>
536 </head>
537 <body>
538 <xsl:call-template name="body.attributes"/>
539 <xsl:call-template name="user.header.content">
540 <xsl:with-param name="node" select="$doc"/>
541 </xsl:call-template>
542 <xsl:apply-templates select="."/>
543 <xsl:call-template name="user.footer.content">
544 <xsl:with-param name="node" select="$doc"/>
545 </xsl:call-template>
546 </body>
547 </html>
548 <xsl:value-of select="$html.append"/>
549
550 <!-- Generate any css files only once, not once per chunk -->
551 <xsl:call-template name="generate.css.files"/>
552</xsl:template>
553
554<xsl:template name="root.attributes">
555 <!-- customize to add attributes to <html> element -->
556</xsl:template>
557
558<xsl:template name="root.messages">
559 <!-- redefine this any way you'd like to output messages -->
560 <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
561</xsl:template>
562
563<!-- ==================================================================== -->
564
565<xsl:template name="chunk">
566 <xsl:param name="node" select="."/>
567
568 <!-- The default is that we are not chunking... -->
569 <xsl:text>0</xsl:text>
570</xsl:template>
571
572</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.