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:exsl="http://exslt.org/common" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="exsl" version="1.0">
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"/>
8 <!-- ********************************************************************
9 $Id: docbook.xsl 9983 2015-09-16 20:58:50Z bobstayton $
10 ********************************************************************
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.
16 ******************************************************************** -->
18 <!-- ==================================================================== -->
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="its.xsl"/>
48 <xsl:include href="info.xsl"/>
49 <xsl:include href="keywords.xsl"/>
50 <xsl:include href="division.xsl"/>
51 <xsl:include href="toc.xsl"/>
52 <xsl:include href="index.xsl"/>
53 <xsl:include href="refentry.xsl"/>
54 <xsl:include href="math.xsl"/>
55 <xsl:include href="admon.xsl"/>
56 <xsl:include href="component.xsl"/>
57 <xsl:include href="biblio.xsl"/>
58 <xsl:include href="biblio-iso690.xsl"/>
59 <xsl:include href="glossary.xsl"/>
60 <xsl:include href="block.xsl"/>
61 <xsl:include href="task.xsl"/>
62 <xsl:include href="qandaset.xsl"/>
63 <xsl:include href="synop.xsl"/>
64 <xsl:include href="titlepage.xsl"/>
65 <xsl:include href="titlepage.templates.xsl"/>
66 <xsl:include href="pi.xsl"/>
67 <xsl:include href="ebnf.xsl"/>
68 <xsl:include href="chunker.xsl"/>
69 <xsl:include href="html-rtf.xsl"/>
70 <xsl:include href="annotations.xsl"/>
71 <xsl:include href="../common/stripns.xsl"/>
72 <xsl:include href="publishers.xsl"/>
74 <xsl:param name="stylesheet.result.type" select="'xhtml'"/>
75 <xsl:param name="htmlhelp.output" select="0"/>
77 <!-- ==================================================================== -->
79 <xsl:key name="id" match="*" use="@id|@xml:id"/>
80 <xsl:key name="gid" match="*" use="generate-id()"/>
82 <!-- ==================================================================== -->
84 <xsl:template match="*">
86 <xsl:text>Element </xsl:text>
87 <xsl:value-of select="local-name(.)"/>
88 <xsl:text> in namespace '</xsl:text>
89 <xsl:value-of select="namespace-uri(.)"/>
90 <xsl:text>' encountered</xsl:text>
91 <xsl:if test="parent::*">
92 <xsl:text> in </xsl:text>
93 <xsl:value-of select="name(parent::*)"/>
95 <xsl:text>, but no template matches.</xsl:text>
98 <span style="color: red">
99 <xsl:text><</xsl:text>
100 <xsl:value-of select="name(.)"/>
101 <xsl:text>></xsl:text>
102 <xsl:apply-templates/>
103 <xsl:text></</xsl:text>
104 <xsl:value-of select="name(.)"/>
105 <xsl:text>></xsl:text>
109 <xsl:template match="text()">
110 <xsl:value-of select="."/>
113 <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>
114 <!-- no apply-templates; make it empty except for dir for rtl-->
117 <xsl:template name="head.content.base">
118 <xsl:param name="node" select="."/>
119 <base href="{$html.base}"/>
122 <xsl:template name="head.content.abstract">
123 <xsl:param name="node" select="."/>
124 <xsl:variable name="info" select="(articleinfo |bookinfo |prefaceinfo |chapterinfo |appendixinfo |sectioninfo |sect1info |sect2info |sect3info |sect4info |sect5info |referenceinfo |refentryinfo |partinfo |info |docinfo)[1]"/>
125 <xsl:if test="$info and $info/abstract">
126 <meta name="description">
127 <xsl:attribute name="content">
128 <xsl:for-each select="$info/abstract[1]/*">
129 <xsl:value-of select="normalize-space(.)"/>
130 <xsl:if test="position() < last()">
131 <xsl:text> </xsl:text>
139 <xsl:template name="head.content.link.made">
140 <xsl:param name="node" select="."/>
142 <link rev="made" href="{$link.mailto.url}"/>
145 <xsl:template name="head.content.generator">
146 <xsl:param name="node" select="."/>
147 <meta name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/>
150 <xsl:template name="head.content.style">
151 <xsl:param name="node" select="."/>
152 <style type="text/css"><xsl:text>
153 body { background-image: url('</xsl:text>
154 <xsl:value-of select="$draft.watermark.image"/><xsl:text>');
155 background-repeat: no-repeat;
156 background-position: top left;
157 /* The following properties make the watermark "fixed" on the page. */
158 /* I think that's just a bit too distracting for the reader... */
159 /* background-attachment: fixed; */
160 /* background-position: center center; */
165 <xsl:template name="head.content">
166 <xsl:param name="node" select="."/>
167 <xsl:param name="title">
168 <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
171 <xsl:call-template name="user.head.title">
172 <xsl:with-param name="title" select="$title"/>
173 <xsl:with-param name="node" select="$node"/>
176 <xsl:if test="$html.base != ''">
177 <xsl:call-template name="head.content.base">
178 <xsl:with-param name="node" select="$node"/>
182 <!-- Insert links to CSS files or insert literal style elements -->
183 <xsl:call-template name="generate.css"/>
185 <xsl:if test="$html.stylesheet != ''">
186 <xsl:call-template name="output.html.stylesheets">
187 <xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/>
191 <xsl:if test="$html.script != ''">
192 <xsl:call-template name="output.html.scripts">
193 <xsl:with-param name="scripts" select="normalize-space($html.script)"/>
197 <xsl:if test="$link.mailto.url != ''">
198 <xsl:call-template name="head.content.link.made">
199 <xsl:with-param name="node" select="$node"/>
203 <xsl:call-template name="head.content.generator">
204 <xsl:with-param name="node" select="$node"/>
207 <xsl:if test="$generate.meta.abstract != 0">
208 <xsl:call-template name="head.content.abstract">
209 <xsl:with-param name="node" select="$node"/>
213 <xsl:if test="($draft.mode = 'yes' or ($draft.mode = 'maybe' and ancestor-or-self::*[@status][1]/@status = 'draft')) and $draft.watermark.image != ''">
214 <xsl:call-template name="head.content.style">
215 <xsl:with-param name="node" select="$node"/>
218 <xsl:apply-templates select="." mode="head.keywords.content"/>
221 <xsl:template name="output.html.stylesheets">
222 <xsl:param name="stylesheets" select="''"/>
225 <xsl:when test="contains($stylesheets, ' ')">
226 <xsl:variable name="css.filename" select="substring-before($stylesheets, ' ')"/>
228 <xsl:call-template name="make.css.link">
229 <xsl:with-param name="css.filename" select="$css.filename"/>
232 <xsl:call-template name="output.html.stylesheets">
233 <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
236 <xsl:when test="$stylesheets != ''">
237 <xsl:call-template name="make.css.link">
238 <xsl:with-param name="css.filename" select="$stylesheets"/>
244 <xsl:template name="output.html.scripts">
245 <xsl:param name="scripts" select="''"/>
248 <xsl:when test="contains($scripts, ' ')">
249 <xsl:variable name="script.filename" select="substring-before($scripts, ' ')"/>
251 <xsl:call-template name="make.script.link">
252 <xsl:with-param name="script.filename" select="$script.filename"/>
255 <xsl:call-template name="output.html.scripts">
256 <xsl:with-param name="scripts" select="substring-after($scripts, ' ')"/>
259 <xsl:when test="$scripts != ''">
260 <xsl:call-template name="make.script.link">
261 <xsl:with-param name="script.filename" select="$scripts"/>
267 <!-- ============================================================ -->
269 <xsl:template match="*" mode="head.keywords.content">
270 <xsl:apply-templates select="chapterinfo/keywordset" mode="html.header"/>
271 <xsl:apply-templates select="appendixinfo/keywordset" mode="html.header"/>
272 <xsl:apply-templates select="prefaceinfo/keywordset" mode="html.header"/>
273 <xsl:apply-templates select="bookinfo/keywordset" mode="html.header"/>
274 <xsl:apply-templates select="setinfo/keywordset" mode="html.header"/>
275 <xsl:apply-templates select="articleinfo/keywordset" mode="html.header"/>
276 <xsl:apply-templates select="artheader/keywordset" mode="html.header"/>
277 <xsl:apply-templates select="sect1info/keywordset" mode="html.header"/>
278 <xsl:apply-templates select="sect2info/keywordset" mode="html.header"/>
279 <xsl:apply-templates select="sect3info/keywordset" mode="html.header"/>
280 <xsl:apply-templates select="sect4info/keywordset" mode="html.header"/>
281 <xsl:apply-templates select="sect5info/keywordset" mode="html.header"/>
282 <xsl:apply-templates select="sectioninfo/keywordset" mode="html.header"/>
283 <xsl:apply-templates select="refsect1info/keywordset" mode="html.header"/>
284 <xsl:apply-templates select="refsect2info/keywordset" mode="html.header"/>
285 <xsl:apply-templates select="refsect3info/keywordset" mode="html.header"/>
286 <xsl:apply-templates select="bibliographyinfo/keywordset" mode="html.header"/>
287 <xsl:apply-templates select="glossaryinfo/keywordset" mode="html.header"/>
288 <xsl:apply-templates select="indexinfo/keywordset" mode="html.header"/>
289 <xsl:apply-templates select="refentryinfo/keywordset" mode="html.header"/>
290 <xsl:apply-templates select="partinfo/keywordset" mode="html.header"/>
291 <xsl:apply-templates select="referenceinfo/keywordset" mode="html.header"/>
292 <xsl:apply-templates select="docinfo/keywordset" mode="html.header"/>
293 <xsl:apply-templates select="info/keywordset" mode="html.header"/>
295 <xsl:if test="$inherit.keywords != 0 and parent::*">
296 <xsl:apply-templates select="parent::*" mode="head.keywords.content"/>
300 <!-- ============================================================ -->
302 <xsl:template name="system.head.content">
303 <xsl:param name="node" select="."/>
305 <!-- FIXME: When chunking, only the annotations actually used
306 in this chunk should be referenced. I don't think it
307 does any harm to reference them all, but it adds
308 unnecessary bloat to each chunk. -->
309 <xsl:if test="$annotation.support != 0 and //annotation">
310 <xsl:call-template name="add.annotation.links"/>
311 <script type="text/javascript">
313 // Create PopupWindow objects</xsl:text>
314 <xsl:for-each select="//annotation">
316 var popup_</xsl:text>
317 <xsl:value-of select="generate-id(.)"/>
318 <xsl:text> = new PopupWindow("popup-</xsl:text>
319 <xsl:value-of select="generate-id(.)"/>
322 <xsl:text>popup_</xsl:text>
323 <xsl:value-of select="generate-id(.)"/>
324 <xsl:text>.offsetY = 15;
326 <xsl:text>popup_</xsl:text>
327 <xsl:value-of select="generate-id(.)"/>
328 <xsl:text>.autoHide();
333 <style type="text/css">
334 <xsl:value-of select="$annotation.css"/>
338 <!-- system.head.content is like user.head.content, except that
339 it is called before head.content. This is important because it
340 means, for example, that <style> elements output by system.head.content
341 have a lower CSS precedence than the users stylesheet. -->
344 <!-- ============================================================ -->
346 <xsl:template name="user.preroot">
347 <!-- Pre-root output, can be used to output comments and PIs. -->
348 <!-- This must not output any element content! -->
351 <xsl:template name="user.head.title">
352 <xsl:param name="node" select="."/>
353 <xsl:param name="title"/>
356 <xsl:copy-of select="$title"/>
360 <xsl:template name="user.head.content">
361 <xsl:param name="node" select="."/>
364 <xsl:template name="user.header.navigation">
365 <xsl:param name="node" select="."/>
366 <xsl:param name="prev" select="/foo"/>
367 <xsl:param name="next" select="/foo"/>
368 <xsl:param name="nav.context"/>
371 <xsl:template name="user.header.content">
372 <xsl:param name="node" select="."/>
375 <xsl:template name="user.footer.content">
376 <xsl:param name="node" select="."/>
379 <xsl:template name="user.footer.navigation">
380 <xsl:param name="node" select="."/>
381 <xsl:param name="prev" select="/foo"/>
382 <xsl:param name="next" select="/foo"/>
383 <xsl:param name="nav.context"/>
386 <!-- To use the same namespace-adjusted nodeset everywhere, it should
387 be created as a global variable here.
388 Used by docbook.xsl, chunk-common.xsl, chunktoc.xsl, and
389 chunk-code.xsl; and in $chunk.hierarchy used in chunkfast.xsl -->
390 <xsl:variable name="no.namespace">
391 <xsl:if test="$exsl.node.set.available != 0 and namespace-uri(/*) = 'http://docbook.org/ns/docbook'">
392 <xsl:apply-templates select="/*" mode="stripNS"/>
396 <xsl:template match="/">
397 <!-- * Get a title for current doc so that we let the user -->
398 <!-- * know what document we are processing at this point. -->
399 <xsl:variable name="doc.title">
400 <xsl:call-template name="get.doc.title"/>
403 <!-- fix namespace if necessary -->
404 <xsl:when test="$exsl.node.set.available != 0 and namespace-uri(/*) = 'http://docbook.org/ns/docbook'">
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>
411 <xsl:with-param name="message">
412 <xsl:text>stripped namespace before processing</xsl:text>
415 <!-- DEBUG: uncomment to save namespace-fixed document.
416 <xsl:message>Saving namespace-fixed document.</xsl:message>
417 <xsl:call-template name="write.chunk">
418 <xsl:with-param name="filename" select="'namespace-fixed.debug.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)"/>
425 <xsl:apply-templates select="exsl:node-set($no.namespace)"/>
427 <!-- Can't process unless namespace fixed with exsl node-set()-->
428 <xsl:when test="namespace-uri(/*) = 'http://docbook.org/ns/docbook'">
429 <xsl:message terminate="yes">
430 <xsl:text>Unable to strip the namespace from DB5 document,</xsl:text>
431 <xsl:text> cannot proceed.</xsl:text>
436 <xsl:when test="$rootid != ''">
438 <xsl:when test="count(key('id',$rootid)) = 0">
439 <xsl:message terminate="yes">
440 <xsl:text>ID '</xsl:text>
441 <xsl:value-of select="$rootid"/>
442 <xsl:text>' not found in document.</xsl:text>
446 <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
447 <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
449 <xsl:if test="$collect.xref.targets != 'only'">
450 <xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
451 <xsl:if test="$tex.math.in.alt != ''">
452 <xsl:apply-templates select="key('id',$rootid)" mode="collect.tex.math"/>
459 <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
460 <xsl:apply-templates select="/" mode="collect.targets"/>
462 <xsl:if test="$collect.xref.targets != 'only'">
463 <xsl:apply-templates select="/" mode="process.root"/>
464 <xsl:if test="$tex.math.in.alt != ''">
465 <xsl:apply-templates select="/" mode="collect.tex.math"/>
474 <xsl:template match="*" mode="process.root">
475 <xsl:variable name="doc" select="self::*"/>
477 <xsl:call-template name="user.preroot"/>
478 <xsl:call-template name="root.messages"/>
481 <xsl:call-template name="root.attributes"/>
483 <xsl:call-template name="system.head.content">
484 <xsl:with-param name="node" select="$doc"/>
486 <xsl:call-template name="head.content">
487 <xsl:with-param name="node" select="$doc"/>
489 <xsl:call-template name="user.head.content">
490 <xsl:with-param name="node" select="$doc"/>
494 <xsl:call-template name="body.attributes"/>
495 <xsl:call-template name="user.header.content">
496 <xsl:with-param name="node" select="$doc"/>
498 <xsl:apply-templates select="."/>
499 <xsl:call-template name="user.footer.content">
500 <xsl:with-param name="node" select="$doc"/>
504 <xsl:value-of select="$html.append"/>
506 <!-- Generate any css files only once, not once per chunk -->
507 <xsl:call-template name="generate.css.files"/>
510 <xsl:template name="root.attributes">
511 <!-- customize to add attributes to <html> element -->
514 <xsl:template name="root.messages">
515 <!-- redefine this any way you'd like to output messages -->
516 <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
519 <!-- ==================================================================== -->
521 <xsl:template name="chunk">
522 <xsl:param name="node" select="."/>
524 <!-- The default is that we are not chunking... -->
525 <xsl:text>0</xsl:text>