1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--This file was created automatically by xhtml2xhtml5.xsl from the xhtml stylesheet.-->
3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook" xmlns:exsl="http://exslt.org/common" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="exsl d" version="1.0">
5 <!--Same as xhtml but with doctypes removed from xsl:output -->
6 <!--and including from ../xhtml directory -->
7 <xslo:output xmlns:xslo="http://www.w3.org/1999/XSL/Transform" method="xml" encoding="UTF-8" indent="no"/>
9 <!-- ********************************************************************
11 This file is part of the XSL DocBook Stylesheet distribution.
12 See ../README or http://cdn.docbook.org/release/xsl/current/ for
13 copyright and other information.
15 ******************************************************************** -->
17 <!-- ==================================================================== -->
19 <xsl:include href="../VERSION.xsl"/>
20 <xsl:include href="../xhtml/param.xsl"/>
21 <xsl:include href="../lib/lib.xsl"/>
22 <xsl:include href="../common/l10n.xsl"/>
23 <xsl:include href="../common/common.xsl"/>
24 <xsl:include href="../common/utility.xsl"/>
25 <xsl:include href="../common/labels.xsl"/>
26 <xsl:include href="../common/titles.xsl"/>
27 <xsl:include href="../common/subtitles.xsl"/>
28 <xsl:include href="../common/gentext.xsl"/>
29 <xsl:include href="../common/targets.xsl"/>
30 <xsl:include href="../common/olink.xsl"/>
31 <xsl:include href="../common/pi.xsl"/>
32 <xsl:include href="../xhtml/autotoc.xsl"/>
33 <xsl:include href="../xhtml/autoidx.xsl"/>
34 <xsl:include href="../xhtml/lists.xsl"/>
35 <xsl:include href="../xhtml/callout.xsl"/>
36 <xsl:include href="../xhtml/verbatim.xsl"/>
37 <xsl:include href="../xhtml/graphics.xsl"/>
38 <xsl:include href="../xhtml/xref.xsl"/>
39 <xsl:include href="../xhtml/formal.xsl"/>
40 <xsl:include href="../xhtml/table.xsl"/>
41 <xsl:include href="../xhtml/htmltbl.xsl"/>
42 <xsl:include href="../xhtml/sections.xsl"/>
43 <xsl:include href="../xhtml/inline.xsl"/>
44 <xsl:include href="../xhtml/footnote.xsl"/>
45 <xsl:include href="../xhtml/html.xsl"/>
46 <xsl:include href="../xhtml/its.xsl"/>
47 <xsl:include href="../xhtml/info.xsl"/>
48 <xsl:include href="../xhtml/keywords.xsl"/>
49 <xsl:include href="../xhtml/division.xsl"/>
50 <xsl:include href="../xhtml/toc.xsl"/>
51 <xsl:include href="../xhtml/index.xsl"/>
52 <xsl:include href="../xhtml/refentry.xsl"/>
53 <xsl:include href="../xhtml/math.xsl"/>
54 <xsl:include href="../xhtml/admon.xsl"/>
55 <xsl:include href="../xhtml/component.xsl"/>
56 <xsl:include href="../xhtml/biblio.xsl"/>
57 <xsl:include href="../xhtml/biblio-iso690.xsl"/>
58 <xsl:include href="../xhtml/glossary.xsl"/>
59 <xsl:include href="../xhtml/block.xsl"/>
60 <xsl:include href="../xhtml/task.xsl"/>
61 <xsl:include href="../xhtml/qandaset.xsl"/>
62 <xsl:include href="../xhtml/synop.xsl"/>
63 <xsl:include href="../xhtml/titlepage.xsl"/>
64 <xsl:include href="../xhtml/titlepage.templates.xsl"/>
65 <xsl:include href="../xhtml/pi.xsl"/>
66 <xsl:include href="../xhtml/ebnf.xsl"/>
67 <xsl:include href="../xhtml/chunker.xsl"/>
68 <xsl:include href="../xhtml/html-rtf.xsl"/>
69 <xsl:include href="../xhtml/annotations.xsl"/>
70 <xsl:include href="../common/addns.xsl"/>
71 <xsl:include href="../xhtml/publishers.xsl"/>
73 <xsl:param name="stylesheet.result.type" select="'xhtml'"/>
74 <xsl:param name="htmlhelp.output" select="0"/>
76 <!-- ==================================================================== -->
78 <xsl:key name="id" match="*" use="@id|@xml:id"/>
79 <xsl:key name="gid" match="*" use="generate-id()"/>
81 <!-- ==================================================================== -->
83 <xsl:template match="*">
85 <xsl:text>Element </xsl:text>
86 <xsl:value-of select="local-name(.)"/>
87 <xsl:text> in namespace '</xsl:text>
88 <xsl:value-of select="namespace-uri(.)"/>
89 <xsl:text>' encountered</xsl:text>
90 <xsl:if test="parent::*">
91 <xsl:text> in </xsl:text>
92 <xsl:value-of select="name(parent::*)"/>
94 <xsl:text>, but no template matches.</xsl:text>
97 <span style="color: red">
98 <xsl:text><</xsl:text>
99 <xsl:value-of select="name(.)"/>
100 <xsl:text>></xsl:text>
101 <xsl:apply-templates/>
102 <xsl:text></</xsl:text>
103 <xsl:value-of select="name(.)"/>
104 <xsl:text>></xsl:text>
108 <xsl:template match="text()">
109 <xsl:value-of select="."/>
112 <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>
113 <!-- no apply-templates; make it empty except for dir for rtl-->
116 <xsl:template name="head.content.base">
117 <xsl:param name="node" select="."/>
118 <base href="{$html.base}"/>
121 <xsl:template name="head.content.abstract">
122 <xsl:param name="node" select="."/>
123 <xsl:variable name="info" select="(d:articleinfo |d:bookinfo |d:prefaceinfo |d:chapterinfo |d:appendixinfo |d:sectioninfo |d:sect1info |d:sect2info |d:sect3info |d:sect4info |d:sect5info |d:referenceinfo |d:refentryinfo |d:partinfo |d:info |d:docinfo)[1]"/>
124 <xsl:if test="$info and $info/d:abstract">
125 <meta name="description">
126 <xsl:attribute name="content">
127 <xsl:for-each select="$info/d:abstract[1]/*">
128 <xsl:value-of select="normalize-space(.)"/>
129 <xsl:if test="position() < last()">
130 <xsl:text> </xsl:text>
138 <xsl:template name="head.content.link.made">
139 <xsl:param name="node" select="."/>
141 <link rev="made" href="{$link.mailto.url}"/>
144 <xsl:template name="head.content.generator">
145 <xsl:param name="node" select="."/>
146 <meta name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/>
149 <xsl:template name="head.content.style">
150 <xsl:param name="node" select="."/>
151 <style type="text/css"><xsl:text>
152 body { background-image: url('</xsl:text>
153 <xsl:value-of select="$draft.watermark.image"/><xsl:text>');
154 background-repeat: no-repeat;
155 background-position: top left;
156 /* The following properties make the watermark "fixed" on the page. */
157 /* I think that's just a bit too distracting for the reader... */
158 /* background-attachment: fixed; */
159 /* background-position: center center; */
164 <xsl:template name="head.content">
165 <xsl:param name="node" select="."/>
166 <xsl:param name="title">
167 <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
170 <xsl:call-template name="user.head.title">
171 <xsl:with-param name="title" select="$title"/>
172 <xsl:with-param name="node" select="$node"/>
175 <xsl:if test="$html.base != ''">
176 <xsl:call-template name="head.content.base">
177 <xsl:with-param name="node" select="$node"/>
181 <!-- Insert links to CSS files or insert literal style elements -->
182 <xsl:call-template name="generate.css"/>
184 <xsl:if test="$html.stylesheet != ''">
185 <xsl:call-template name="output.html.stylesheets">
186 <xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/>
190 <xsl:if test="$html.script != ''">
191 <xsl:call-template name="output.html.scripts">
192 <xsl:with-param name="scripts" select="normalize-space($html.script)"/>
196 <xsl:if test="$link.mailto.url != ''">
197 <xsl:call-template name="head.content.link.made">
198 <xsl:with-param name="node" select="$node"/>
202 <xsl:call-template name="head.content.generator">
203 <xsl:with-param name="node" select="$node"/>
206 <xsl:if test="$generate.meta.abstract != 0">
207 <xsl:call-template name="head.content.abstract">
208 <xsl:with-param name="node" select="$node"/>
212 <xsl:if test="($draft.mode = 'yes' or ($draft.mode = 'maybe' and ancestor-or-self::*[@status][1]/@status = 'draft')) and $draft.watermark.image != ''">
213 <xsl:call-template name="head.content.style">
214 <xsl:with-param name="node" select="$node"/>
217 <xsl:apply-templates select="." mode="head.keywords.content"/>
220 <xsl:template name="output.html.stylesheets">
221 <xsl:param name="stylesheets" select="''"/>
224 <xsl:when test="contains($stylesheets, ' ')">
225 <xsl:variable name="css.filename" select="substring-before($stylesheets, ' ')"/>
227 <xsl:call-template name="make.css.link">
228 <xsl:with-param name="css.filename" select="$css.filename"/>
231 <xsl:call-template name="output.html.stylesheets">
232 <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
235 <xsl:when test="$stylesheets != ''">
236 <xsl:call-template name="make.css.link">
237 <xsl:with-param name="css.filename" select="$stylesheets"/>
243 <xsl:template name="output.html.scripts">
244 <xsl:param name="scripts" select="''"/>
247 <xsl:when test="contains($scripts, ' ')">
248 <xsl:variable name="script.filename" select="substring-before($scripts, ' ')"/>
250 <xsl:call-template name="make.script.link">
251 <xsl:with-param name="script.filename" select="$script.filename"/>
254 <xsl:call-template name="output.html.scripts">
255 <xsl:with-param name="scripts" select="substring-after($scripts, ' ')"/>
258 <xsl:when test="$scripts != ''">
259 <xsl:call-template name="make.script.link">
260 <xsl:with-param name="script.filename" select="$scripts"/>
266 <!-- ============================================================ -->
268 <xsl:template match="*" mode="head.keywords.content">
269 <xsl:apply-templates select="d:chapterinfo/d:keywordset" mode="html.header"/>
270 <xsl:apply-templates select="d:appendixinfo/d:keywordset" mode="html.header"/>
271 <xsl:apply-templates select="d:prefaceinfo/d:keywordset" mode="html.header"/>
272 <xsl:apply-templates select="d:bookinfo/d:keywordset" mode="html.header"/>
273 <xsl:apply-templates select="d:setinfo/d:keywordset" mode="html.header"/>
274 <xsl:apply-templates select="d:articleinfo/d:keywordset" mode="html.header"/>
275 <xsl:apply-templates select="d:artheader/d:keywordset" mode="html.header"/>
276 <xsl:apply-templates select="d:sect1info/d:keywordset" mode="html.header"/>
277 <xsl:apply-templates select="d:sect2info/d:keywordset" mode="html.header"/>
278 <xsl:apply-templates select="d:sect3info/d:keywordset" mode="html.header"/>
279 <xsl:apply-templates select="d:sect4info/d:keywordset" mode="html.header"/>
280 <xsl:apply-templates select="d:sect5info/d:keywordset" mode="html.header"/>
281 <xsl:apply-templates select="d:sectioninfo/d:keywordset" mode="html.header"/>
282 <xsl:apply-templates select="d:refsect1info/d:keywordset" mode="html.header"/>
283 <xsl:apply-templates select="d:refsect2info/d:keywordset" mode="html.header"/>
284 <xsl:apply-templates select="d:refsect3info/d:keywordset" mode="html.header"/>
285 <xsl:apply-templates select="d:bibliographyinfo/d:keywordset" mode="html.header"/>
286 <xsl:apply-templates select="d:glossaryinfo/d:keywordset" mode="html.header"/>
287 <xsl:apply-templates select="d:indexinfo/d:keywordset" mode="html.header"/>
288 <xsl:apply-templates select="d:refentryinfo/d:keywordset" mode="html.header"/>
289 <xsl:apply-templates select="d:partinfo/d:keywordset" mode="html.header"/>
290 <xsl:apply-templates select="d:referenceinfo/d:keywordset" mode="html.header"/>
291 <xsl:apply-templates select="d:docinfo/d:keywordset" mode="html.header"/>
292 <xsl:apply-templates select="d:info/d:keywordset" mode="html.header"/>
294 <xsl:if test="$inherit.keywords != 0 and parent::*">
295 <xsl:apply-templates select="parent::*" mode="head.keywords.content"/>
299 <!-- ============================================================ -->
301 <xsl:template name="system.head.content">
302 <xsl:param name="node" select="."/>
304 <!-- FIXME: When chunking, only the annotations actually used
305 in this chunk should be referenced. I don't think it
306 does any harm to reference them all, but it adds
307 unnecessary bloat to each chunk. -->
308 <xsl:if test="$annotation.support != 0 and //d:annotation">
309 <xsl:call-template name="add.annotation.links"/>
310 <script type="text/javascript">
312 // Create PopupWindow objects</xsl:text>
313 <xsl:for-each select="//d:annotation">
315 var popup_</xsl:text>
316 <xsl:value-of select="generate-id(.)"/>
317 <xsl:text> = new PopupWindow("popup-</xsl:text>
318 <xsl:value-of select="generate-id(.)"/>
321 <xsl:text>popup_</xsl:text>
322 <xsl:value-of select="generate-id(.)"/>
323 <xsl:text>.offsetY = 15;
325 <xsl:text>popup_</xsl:text>
326 <xsl:value-of select="generate-id(.)"/>
327 <xsl:text>.autoHide();
332 <style type="text/css">
333 <xsl:value-of select="$annotation.css"/>
337 <!-- system.head.content is like user.head.content, except that
338 it is called before head.content. This is important because it
339 means, for example, that <style> elements output by system.head.content
340 have a lower CSS precedence than the users stylesheet. -->
343 <!-- ============================================================ -->
345 <xsl:template name="user.preroot">
346 <!-- Pre-root output, can be used to output comments and PIs. -->
347 <!-- This must not output any element content! -->
350 <xsl:template name="user.head.title">
351 <xsl:param name="node" select="."/>
352 <xsl:param name="title"/>
355 <xsl:copy-of select="$title"/>
359 <xsl:template name="user.head.content">
360 <xsl:param name="node" select="."/>
363 <xsl:template name="user.header.navigation">
364 <xsl:param name="node" select="."/>
365 <xsl:param name="prev" select="/d:foo"/>
366 <xsl:param name="next" select="/d:foo"/>
367 <xsl:param name="nav.context"/>
370 <xsl:template name="user.header.content">
371 <xsl:param name="node" select="."/>
374 <xsl:template name="user.footer.content">
375 <xsl:param name="node" select="."/>
378 <xsl:template name="user.footer.navigation">
379 <xsl:param name="node" select="."/>
380 <xsl:param name="prev" select="/d:foo"/>
381 <xsl:param name="next" select="/d:foo"/>
382 <xsl:param name="nav.context"/>
385 <!-- To use the same namespace-adjusted nodeset everywhere, it should
386 be created as a global variable here.
387 Used by docbook.xsl, chunk-common.xsl, chunktoc.xsl, and
388 chunk-code.xsl; and in $chunk.hierarchy used in chunkfast.xsl -->
389 <xsl:variable name="with.namespace">
390 <xsl:if test="$exsl.node.set.available != 0 and namespace-uri(/*) != 'http://docbook.org/ns/docbook'">
391 <xsl:apply-templates select="/*" mode="addNS"/>
395 <xsl:template match="/">
396 <!-- * Get a title for current doc so that we let the user -->
397 <!-- * know what document we are processing at this point. -->
398 <xsl:variable name="doc.title">
399 <xsl:call-template name="get.doc.title"/>
402 <!-- fix namespace if necessary -->
403 <xsl:when test="$exsl.node.set.available != 0 and namespace-uri(/*) != 'http://docbook.org/ns/docbook'">
404 <xsl:call-template name="log.message">
405 <xsl:with-param name="level">Note</xsl:with-param>
406 <xsl:with-param name="source" select="$doc.title"/>
407 <xsl:with-param name="context-desc">
408 <xsl:text>namesp. add</xsl:text>
410 <xsl:with-param name="message">
411 <xsl:text>added namespace before processing</xsl:text>
414 <!-- DEBUG: uncomment to save namespace-fixed document.
415 <xsl:message>Saving namespace-fixed document.</xsl:message>
416 <xsl:call-template name="write.chunk">
417 <xsl:with-param name="filename" select="'namespace-fixed.debug.xml'"/>
418 <xsl:with-param name="method" select="'xml'"/>
419 <xsl:with-param name="content">
420 <xsl:copy-of select="exsl:node-set($with.namespace)"/>
424 <xsl:apply-templates select="exsl:node-set($with.namespace)"/>
426 <!-- Can't process unless namespace fixed with exsl node-set()-->
427 <xsl:when test="namespace-uri(/*) != 'http://docbook.org/ns/docbook'">
428 <xsl:message terminate="yes">
429 <xsl:text>Unable to add the namespace from DB4 document,</xsl:text>
430 <xsl:text> cannot proceed.</xsl:text>
435 <xsl:when test="$rootid != ''">
437 <xsl:when test="count(key('id',$rootid)) = 0">
438 <xsl:message terminate="yes">
439 <xsl:text>ID '</xsl:text>
440 <xsl:value-of select="$rootid"/>
441 <xsl:text>' not found in document.</xsl:text>
445 <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
446 <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
448 <xsl:if test="$collect.xref.targets != 'only'">
449 <xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
450 <xsl:if test="$tex.math.in.alt != ''">
451 <xsl:apply-templates select="key('id',$rootid)" mode="collect.tex.math"/>
458 <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
459 <xsl:apply-templates select="/" mode="collect.targets"/>
461 <xsl:if test="$collect.xref.targets != 'only'">
462 <xsl:apply-templates select="/" mode="process.root"/>
463 <xsl:if test="$tex.math.in.alt != ''">
464 <xsl:apply-templates select="/" mode="collect.tex.math"/>
473 <xsl:template match="*" mode="process.root">
474 <xsl:variable name="doc" select="self::*"/>
476 <xsl:call-template name="user.preroot"/>
477 <xsl:call-template name="root.messages"/>
480 <xsl:call-template name="root.attributes"/>
482 <xsl:call-template name="system.head.content">
483 <xsl:with-param name="node" select="$doc"/>
485 <xsl:call-template name="head.content">
486 <xsl:with-param name="node" select="$doc"/>
488 <xsl:call-template name="user.head.content">
489 <xsl:with-param name="node" select="$doc"/>
493 <xsl:call-template name="body.attributes"/>
494 <xsl:call-template name="user.header.content">
495 <xsl:with-param name="node" select="$doc"/>
497 <xsl:apply-templates select="."/>
498 <xsl:call-template name="user.footer.content">
499 <xsl:with-param name="node" select="$doc"/>
503 <xsl:value-of select="$html.append"/>
505 <!-- Generate any css files only once, not once per chunk -->
506 <xsl:call-template name="generate.css.files"/>
509 <xsl:template name="root.attributes">
510 <!-- customize to add attributes to <html> element -->
513 <xsl:template name="root.messages">
514 <!-- redefine this any way you'd like to output messages -->
515 <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
518 <!-- ==================================================================== -->
520 <xsl:template name="chunk">
521 <xsl:param name="node" select="."/>
523 <!-- The default is that we are not chunking... -->
524 <xsl:text>0</xsl:text>