1 <?xml version="1.0" encoding="ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets.-->
4 <!--This file was created automatically by xsl2profile-->
5 <!--from the DocBook XSL stylesheets.-->
6 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:exslt="http://exslt.org/common" xmlns:ng="http://docbook.org/docbook-ng" xmlns:db="http://docbook.org/ns/docbook" xmlns="http://www.w3.org/1999/xhtml" exslt:dummy="dummy" ng:dummy="dummy" db:dummy="dummy" extension-element-prefixes="exslt" exclude-result-prefixes="exsl exslt" version="1.0">
8 <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"/>
10 <!-- ********************************************************************
11 $Id: docbook.xsl 9983 2015-09-16 20:58:50Z bobstayton $
12 ********************************************************************
14 This file is part of the XSL DocBook Stylesheet distribution.
15 See ../README or http://docbook.sf.net/release/xsl/current/ for
16 copyright and other information.
18 ******************************************************************** -->
20 <!-- ==================================================================== -->
22 <xsl:include href="../VERSION.xsl"/>
23 <xsl:include href="param.xsl"/>
24 <xsl:include href="../lib/lib.xsl"/>
25 <xsl:include href="../common/l10n.xsl"/>
26 <xsl:include href="../common/common.xsl"/>
27 <xsl:include href="../common/utility.xsl"/>
28 <xsl:include href="../common/labels.xsl"/>
29 <xsl:include href="../common/titles.xsl"/>
30 <xsl:include href="../common/subtitles.xsl"/>
31 <xsl:include href="../common/gentext.xsl"/>
32 <xsl:include href="../common/targets.xsl"/>
33 <xsl:include href="../common/olink.xsl"/>
34 <xsl:include href="../common/pi.xsl"/>
35 <xsl:include href="autotoc.xsl"/>
36 <xsl:include href="autoidx.xsl"/>
37 <xsl:include href="lists.xsl"/>
38 <xsl:include href="callout.xsl"/>
39 <xsl:include href="verbatim.xsl"/>
40 <xsl:include href="graphics.xsl"/>
41 <xsl:include href="xref.xsl"/>
42 <xsl:include href="formal.xsl"/>
43 <xsl:include href="table.xsl"/>
44 <xsl:include href="htmltbl.xsl"/>
45 <xsl:include href="sections.xsl"/>
46 <xsl:include href="inline.xsl"/>
47 <xsl:include href="footnote.xsl"/>
48 <xsl:include href="html.xsl"/>
49 <xsl:include href="its.xsl"/>
50 <xsl:include href="info.xsl"/>
51 <xsl:include href="keywords.xsl"/>
52 <xsl:include href="division.xsl"/>
53 <xsl:include href="toc.xsl"/>
54 <xsl:include href="index.xsl"/>
55 <xsl:include href="refentry.xsl"/>
56 <xsl:include href="math.xsl"/>
57 <xsl:include href="admon.xsl"/>
58 <xsl:include href="component.xsl"/>
59 <xsl:include href="biblio.xsl"/>
60 <xsl:include href="biblio-iso690.xsl"/>
61 <xsl:include href="glossary.xsl"/>
62 <xsl:include href="block.xsl"/>
63 <xsl:include href="task.xsl"/>
64 <xsl:include href="qandaset.xsl"/>
65 <xsl:include href="synop.xsl"/>
66 <xsl:include href="titlepage.xsl"/>
67 <xsl:include href="titlepage.templates.xsl"/>
68 <xsl:include href="pi.xsl"/>
69 <xsl:include href="ebnf.xsl"/>
70 <xsl:include href="chunker.xsl"/>
71 <xsl:include href="html-rtf.xsl"/>
72 <xsl:include href="annotations.xsl"/>
73 <xsl:include href="../common/stripns.xsl"/>
74 <xsl:include href="publishers.xsl"/>
76 <xsl:param name="stylesheet.result.type" select="'xhtml'"/>
77 <xsl:param name="htmlhelp.output" select="0"/>
79 <!-- ==================================================================== -->
81 <xsl:key name="id" match="*" use="@id|@xml:id"/>
82 <xsl:key name="gid" match="*" use="generate-id()"/>
84 <!-- ==================================================================== -->
86 <xsl:template match="*">
88 <xsl:text>Element </xsl:text>
89 <xsl:value-of select="local-name(.)"/>
90 <xsl:text> in namespace '</xsl:text>
91 <xsl:value-of select="namespace-uri(.)"/>
92 <xsl:text>' encountered</xsl:text>
93 <xsl:if test="parent::*">
94 <xsl:text> in </xsl:text>
95 <xsl:value-of select="name(parent::*)"/>
97 <xsl:text>, but no template matches.</xsl:text>
100 <span style="color: red">
101 <xsl:text><</xsl:text>
102 <xsl:value-of select="name(.)"/>
103 <xsl:text>></xsl:text>
104 <xsl:apply-templates/>
105 <xsl:text></</xsl:text>
106 <xsl:value-of select="name(.)"/>
107 <xsl:text>></xsl:text>
111 <xsl:template match="text()">
112 <xsl:value-of select="."/>
115 <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>
116 <!-- no apply-templates; make it empty except for dir for rtl-->
119 <xsl:template name="head.content.base">
120 <xsl:param name="node" select="."/>
121 <base href="{$html.base}"/>
124 <xsl:template name="head.content.abstract">
125 <xsl:param name="node" select="."/>
126 <xsl:variable name="info" select="(articleinfo |bookinfo |prefaceinfo |chapterinfo |appendixinfo |sectioninfo |sect1info |sect2info |sect3info |sect4info |sect5info |referenceinfo |refentryinfo |partinfo |info |docinfo)[1]"/>
127 <xsl:if test="$info and $info/abstract">
128 <meta name="description">
129 <xsl:attribute name="content">
130 <xsl:for-each select="$info/abstract[1]/*">
131 <xsl:value-of select="normalize-space(.)"/>
132 <xsl:if test="position() < last()">
133 <xsl:text> </xsl:text>
141 <xsl:template name="head.content.link.made">
142 <xsl:param name="node" select="."/>
144 <link rev="made" href="{$link.mailto.url}"/>
147 <xsl:template name="head.content.generator">
148 <xsl:param name="node" select="."/>
149 <meta name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/>
152 <xsl:template name="head.content.style">
153 <xsl:param name="node" select="."/>
154 <style type="text/css"><xsl:text>
155 body { background-image: url('</xsl:text>
156 <xsl:value-of select="$draft.watermark.image"/><xsl:text>');
157 background-repeat: no-repeat;
158 background-position: top left;
159 /* The following properties make the watermark "fixed" on the page. */
160 /* I think that's just a bit too distracting for the reader... */
161 /* background-attachment: fixed; */
162 /* background-position: center center; */
167 <xsl:template name="head.content">
168 <xsl:param name="node" select="."/>
169 <xsl:param name="title">
170 <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
173 <xsl:call-template name="user.head.title">
174 <xsl:with-param name="title" select="$title"/>
175 <xsl:with-param name="node" select="$node"/>
178 <xsl:if test="$html.base != ''">
179 <xsl:call-template name="head.content.base">
180 <xsl:with-param name="node" select="$node"/>
184 <!-- Insert links to CSS files or insert literal style elements -->
185 <xsl:call-template name="generate.css"/>
187 <xsl:if test="$html.stylesheet != ''">
188 <xsl:call-template name="output.html.stylesheets">
189 <xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/>
193 <xsl:if test="$html.script != ''">
194 <xsl:call-template name="output.html.scripts">
195 <xsl:with-param name="scripts" select="normalize-space($html.script)"/>
199 <xsl:if test="$link.mailto.url != ''">
200 <xsl:call-template name="head.content.link.made">
201 <xsl:with-param name="node" select="$node"/>
205 <xsl:call-template name="head.content.generator">
206 <xsl:with-param name="node" select="$node"/>
209 <xsl:if test="$generate.meta.abstract != 0">
210 <xsl:call-template name="head.content.abstract">
211 <xsl:with-param name="node" select="$node"/>
215 <xsl:if test="($draft.mode = 'yes' or ($draft.mode = 'maybe' and ancestor-or-self::*[@status][1]/@status = 'draft')) and $draft.watermark.image != ''">
216 <xsl:call-template name="head.content.style">
217 <xsl:with-param name="node" select="$node"/>
220 <xsl:apply-templates select="." mode="head.keywords.content"/>
223 <xsl:template name="output.html.stylesheets">
224 <xsl:param name="stylesheets" select="''"/>
227 <xsl:when test="contains($stylesheets, ' ')">
228 <xsl:variable name="css.filename" select="substring-before($stylesheets, ' ')"/>
230 <xsl:call-template name="make.css.link">
231 <xsl:with-param name="css.filename" select="$css.filename"/>
234 <xsl:call-template name="output.html.stylesheets">
235 <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
238 <xsl:when test="$stylesheets != ''">
239 <xsl:call-template name="make.css.link">
240 <xsl:with-param name="css.filename" select="$stylesheets"/>
246 <xsl:template name="output.html.scripts">
247 <xsl:param name="scripts" select="''"/>
250 <xsl:when test="contains($scripts, ' ')">
251 <xsl:variable name="script.filename" select="substring-before($scripts, ' ')"/>
253 <xsl:call-template name="make.script.link">
254 <xsl:with-param name="script.filename" select="$script.filename"/>
257 <xsl:call-template name="output.html.scripts">
258 <xsl:with-param name="scripts" select="substring-after($scripts, ' ')"/>
261 <xsl:when test="$scripts != ''">
262 <xsl:call-template name="make.script.link">
263 <xsl:with-param name="script.filename" select="$scripts"/>
269 <!-- ============================================================ -->
271 <xsl:template match="*" mode="head.keywords.content">
272 <xsl:apply-templates select="chapterinfo/keywordset" mode="html.header"/>
273 <xsl:apply-templates select="appendixinfo/keywordset" mode="html.header"/>
274 <xsl:apply-templates select="prefaceinfo/keywordset" mode="html.header"/>
275 <xsl:apply-templates select="bookinfo/keywordset" mode="html.header"/>
276 <xsl:apply-templates select="setinfo/keywordset" mode="html.header"/>
277 <xsl:apply-templates select="articleinfo/keywordset" mode="html.header"/>
278 <xsl:apply-templates select="artheader/keywordset" mode="html.header"/>
279 <xsl:apply-templates select="sect1info/keywordset" mode="html.header"/>
280 <xsl:apply-templates select="sect2info/keywordset" mode="html.header"/>
281 <xsl:apply-templates select="sect3info/keywordset" mode="html.header"/>
282 <xsl:apply-templates select="sect4info/keywordset" mode="html.header"/>
283 <xsl:apply-templates select="sect5info/keywordset" mode="html.header"/>
284 <xsl:apply-templates select="sectioninfo/keywordset" mode="html.header"/>
285 <xsl:apply-templates select="refsect1info/keywordset" mode="html.header"/>
286 <xsl:apply-templates select="refsect2info/keywordset" mode="html.header"/>
287 <xsl:apply-templates select="refsect3info/keywordset" mode="html.header"/>
288 <xsl:apply-templates select="bibliographyinfo/keywordset" mode="html.header"/>
289 <xsl:apply-templates select="glossaryinfo/keywordset" mode="html.header"/>
290 <xsl:apply-templates select="indexinfo/keywordset" mode="html.header"/>
291 <xsl:apply-templates select="refentryinfo/keywordset" mode="html.header"/>
292 <xsl:apply-templates select="partinfo/keywordset" mode="html.header"/>
293 <xsl:apply-templates select="referenceinfo/keywordset" mode="html.header"/>
294 <xsl:apply-templates select="docinfo/keywordset" mode="html.header"/>
295 <xsl:apply-templates select="info/keywordset" mode="html.header"/>
297 <xsl:if test="$inherit.keywords != 0 and parent::*">
298 <xsl:apply-templates select="parent::*" mode="head.keywords.content"/>
302 <!-- ============================================================ -->
304 <xsl:template name="system.head.content">
305 <xsl:param name="node" select="."/>
307 <!-- FIXME: When chunking, only the annotations actually used
308 in this chunk should be referenced. I don't think it
309 does any harm to reference them all, but it adds
310 unnecessary bloat to each chunk. -->
311 <xsl:if test="$annotation.support != 0 and //annotation">
312 <xsl:call-template name="add.annotation.links"/>
313 <script type="text/javascript">
315 // Create PopupWindow objects</xsl:text>
316 <xsl:for-each select="//annotation">
318 var popup_</xsl:text>
319 <xsl:value-of select="generate-id(.)"/>
320 <xsl:text> = new PopupWindow("popup-</xsl:text>
321 <xsl:value-of select="generate-id(.)"/>
324 <xsl:text>popup_</xsl:text>
325 <xsl:value-of select="generate-id(.)"/>
326 <xsl:text>.offsetY = 15;
328 <xsl:text>popup_</xsl:text>
329 <xsl:value-of select="generate-id(.)"/>
330 <xsl:text>.autoHide();
335 <style type="text/css">
336 <xsl:value-of select="$annotation.css"/>
340 <!-- system.head.content is like user.head.content, except that
341 it is called before head.content. This is important because it
342 means, for example, that <style> elements output by system.head.content
343 have a lower CSS precedence than the users stylesheet. -->
346 <!-- ============================================================ -->
348 <xsl:template name="user.preroot">
349 <!-- Pre-root output, can be used to output comments and PIs. -->
350 <!-- This must not output any element content! -->
353 <xsl:template name="user.head.title">
354 <xsl:param name="node" select="."/>
355 <xsl:param name="title"/>
358 <xsl:copy-of select="$title"/>
362 <xsl:template name="user.head.content">
363 <xsl:param name="node" select="."/>
366 <xsl:template name="user.header.navigation">
367 <xsl:param name="node" select="."/>
368 <xsl:param name="prev" select="/foo"/>
369 <xsl:param name="next" select="/foo"/>
370 <xsl:param name="nav.context"/>
373 <xsl:template name="user.header.content">
374 <xsl:param name="node" select="."/>
377 <xsl:template name="user.footer.content">
378 <xsl:param name="node" select="."/>
381 <xsl:template name="user.footer.navigation">
382 <xsl:param name="node" select="."/>
383 <xsl:param name="prev" select="/foo"/>
384 <xsl:param name="next" select="/foo"/>
385 <xsl:param name="nav.context"/>
388 <!-- To use the same namespace-adjusted nodeset everywhere, it should
389 be created as a global variable here.
390 Used by docbook.xsl, chunk-common.xsl, chunktoc.xsl, and
391 chunk-code.xsl; and in $chunk.hierarchy used in chunkfast.xsl -->
392 <xsl:variable name="no.namespace">
393 <xsl:if test="$exsl.node.set.available != 0 and namespace-uri(/*) = 'http://docbook.org/ns/docbook'">
394 <xsl:apply-templates select="/*" mode="stripNS"/>
398 <xslo:include xmlns:xslo="http://www.w3.org/1999/XSL/Transform" href="../profiling/profile-mode.xsl"/><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-content"><xslo:choose><xslo:when test="$exsl.node.set.available != 0 and namespace-uri(/*) = 'http://docbook.org/ns/docbook'"><xslo:variable name="no.namespace"><xslo:apply-templates select="/*" mode="stripNS"/></xslo:variable><xslo:call-template name="log.message"><xslo:with-param name="level">Note</xslo:with-param><xslo:with-param name="source"><xslo:call-template name="get.doc.title"/></xslo:with-param><xslo:with-param name="context-desc"><xslo:text>namesp. cut</xslo:text></xslo:with-param><xslo:with-param name="message"><xslo:text>stripped namespace before processing</xslo:text></xslo:with-param></xslo:call-template><xslo:apply-templates select="exslt:node-set($no.namespace)" mode="profile"/></xslo:when><xslo:otherwise><xslo:apply-templates select="/" mode="profile"/></xslo:otherwise></xslo:choose></xslo:variable><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-nodes" select="exslt:node-set($profiled-content)"/><xsl:template match="/">
399 <!-- * Get a title for current doc so that we let the user -->
400 <!-- * know what document we are processing at this point. -->
401 <xsl:variable name="doc.title">
402 <xsl:call-template name="get.doc.title"/>
405 <!-- fix namespace if necessary -->
406 <xsl:when test="false()"/>
407 <!-- Can't process unless namespace fixed with exsl node-set()-->
408 <xsl:when test="false()"/>
411 <xsl:when test="$rootid != ''">
413 <xsl:when test="count($profiled-nodes//*[@id=$rootid or @xml:id=$rootid]) = 0">
414 <xsl:message terminate="yes">
415 <xsl:text>ID '</xsl:text>
416 <xsl:value-of select="$rootid"/>
417 <xsl:text>' not found in document.</xsl:text>
421 <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
422 <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
424 <xsl:if test="$collect.xref.targets != 'only'">
425 <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid or @xml:id=$rootid]" mode="process.root"/>
426 <xsl:if test="$tex.math.in.alt != ''">
427 <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid or @xml:id=$rootid]" mode="collect.tex.math"/>
434 <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
435 <xsl:apply-templates select="$profiled-nodes" mode="collect.targets"/>
437 <xsl:if test="$collect.xref.targets != 'only'">
438 <xsl:apply-templates select="$profiled-nodes" mode="process.root"/>
439 <xsl:if test="$tex.math.in.alt != ''">
440 <xsl:apply-templates select="$profiled-nodes" mode="collect.tex.math"/>
449 <xsl:template match="*" mode="process.root">
450 <xsl:variable name="doc" select="self::*"/>
452 <xsl:call-template name="user.preroot"/>
453 <xsl:call-template name="root.messages"/>
456 <xsl:call-template name="root.attributes"/>
458 <xsl:call-template name="system.head.content">
459 <xsl:with-param name="node" select="$doc"/>
461 <xsl:call-template name="head.content">
462 <xsl:with-param name="node" select="$doc"/>
464 <xsl:call-template name="user.head.content">
465 <xsl:with-param name="node" select="$doc"/>
469 <xsl:call-template name="body.attributes"/>
470 <xsl:call-template name="user.header.content">
471 <xsl:with-param name="node" select="$doc"/>
473 <xsl:apply-templates select="."/>
474 <xsl:call-template name="user.footer.content">
475 <xsl:with-param name="node" select="$doc"/>
479 <xsl:value-of select="$html.append"/>
481 <!-- Generate any css files only once, not once per chunk -->
482 <xsl:call-template name="generate.css.files"/>
485 <xsl:template name="root.attributes">
486 <!-- customize to add attributes to <html> element -->
489 <xsl:template name="root.messages">
490 <!-- redefine this any way you'd like to output messages -->
491 <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
494 <!-- ==================================================================== -->
496 <xsl:template name="chunk">
497 <xsl:param name="node" select="."/>
499 <!-- The default is that we are not chunking... -->
500 <xsl:text>0</xsl:text>