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