1 <?xml version="1.0" encoding="ASCII"?><!--This file was created automatically by html2xhtml--><!--from the HTML stylesheets.--><!--This file was created automatically by xsl2profile--><!--from the DocBook XSL stylesheets.--><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:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0" 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 cf d exslt" version="1.0">
3 <!-- ********************************************************************
5 This file is part of the XSL DocBook Stylesheet distribution.
6 See ../README or http://cdn.docbook.org/release/xsl/current/ for
7 copyright and other information.
9 ******************************************************************** -->
11 <!-- ==================================================================== -->
14 <xsl:template match="*" mode="chunk-filename">
15 <!-- returns the filename of a chunk -->
16 <xsl:variable name="ischunk">
17 <xsl:call-template name="chunk"/>
20 <xsl:variable name="fn">
21 <xsl:apply-templates select="." mode="recursive-chunk-filename"/>
26 <xsl:value-of select="$ischunk"/>
27 <xsl:text> (</xsl:text>
28 <xsl:value-of select="local-name(.)"/>
29 <xsl:text>) </xsl:text>
30 <xsl:value-of select="$fn"/>
31 <xsl:text>, </xsl:text>
32 <xsl:call-template name="dbhtml-dir"/>
36 <!-- 2003-11-25 by ndw:
37 The following test used to read test="$ischunk != 0 and $fn != ''"
38 I've removed the ischunk part of the test so that href.to.uri and
39 href.from.uri will be fully qualified even if the source or target
40 isn't a chunk. I *think* that if $fn != '' then it's appropriate
41 to put the directory on the front, even if the element isn't a
42 chunk. I could be wrong. -->
44 <xsl:if test="$fn != ''">
45 <xsl:call-template name="dbhtml-dir"/>
48 <xsl:value-of select="$chunked.filename.prefix"/>
50 <xsl:value-of select="$fn"/>
51 <!-- You can't add the html.ext here because dbhtml filename= may already -->
52 <!-- have added it. It really does have to be handled in the recursive template -->
55 <xsl:template match="*" mode="recursive-chunk-filename">
56 <xsl:param name="recursive" select="false()"/>
58 <!-- returns the filename of a chunk -->
59 <xsl:variable name="ischunk">
60 <xsl:call-template name="chunk"/>
63 <xsl:variable name="dbhtml-filename">
64 <xsl:call-template name="pi.dbhtml_filename"/>
67 <xsl:variable name="filename">
69 <xsl:when test="$dbhtml-filename != ''">
70 <xsl:value-of select="$dbhtml-filename"/>
72 <!-- if this is the root element, use the root.filename -->
73 <xsl:when test="not(parent::*) and $root.filename != ''">
74 <xsl:value-of select="$root.filename"/>
75 <xsl:value-of select="$html.ext"/>
78 <xsl:when test="self::d:legalnotice and not($generate.legalnotice.link = 0)">
80 <xsl:when test="(@id or @xml:id) and not($use.id.as.filename = 0)">
81 <!-- * if this legalnotice has an ID, then go ahead and use -->
82 <!-- * just the value of that ID as the basename for the file -->
83 <!-- * (that is, without prepending an "ln-" too it) -->
84 <xsl:value-of select="(@id|@xml:id)[1]"/>
85 <xsl:value-of select="$html.ext"/>
88 <!-- * otherwise, if this legalnotice does not have an ID, -->
89 <!-- * then we generate an ID... -->
90 <xsl:variable name="id">
91 <xsl:call-template name="object.id"/>
93 <!-- * ...and then we take that generated ID, prepend an -->
94 <!-- * "ln-" to it, and use that as the basename for the file -->
95 <xsl:value-of select="concat('ln-',$id,$html.ext)"/>
99 <!-- if there's no dbhtml filename, and if we're to use IDs as -->
100 <!-- filenames, then use the ID to generate the filename. -->
101 <xsl:when test="(@id or @xml:id) and $use.id.as.filename != 0">
102 <xsl:value-of select="(@id|@xml:id)[1]"/>
103 <xsl:value-of select="$html.ext"/>
110 <xsl:when test="$ischunk='0'">
111 <!-- if called on something that isn't a chunk, walk up... -->
113 <xsl:when test="count(parent::*)>0">
114 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
115 <xsl:with-param name="recursive" select="$recursive"/>
116 </xsl:apply-templates>
118 <!-- unless there is no up, in which case return "" -->
123 <xsl:when test="not($recursive) and $filename != ''">
124 <!-- if this chunk has an explicit name, use it -->
125 <xsl:value-of select="$filename"/>
128 <!-- treat nested set separate from root -->
129 <xsl:when test="self::d:set and ancestor::d:set">
130 <xsl:text>se</xsl:text>
131 <xsl:number level="any" format="01"/>
132 <xsl:if test="not($recursive)">
133 <xsl:value-of select="$html.ext"/>
137 <xsl:when test="self::d:set">
138 <xsl:value-of select="$root.filename"/>
139 <xsl:if test="not($recursive)">
140 <xsl:value-of select="$html.ext"/>
144 <xsl:when test="self::d:book">
145 <xsl:text>bk</xsl:text>
146 <xsl:number level="any" format="01"/>
147 <xsl:if test="not($recursive)">
148 <xsl:value-of select="$html.ext"/>
152 <xsl:when test="self::d:article">
153 <xsl:if test="/d:set">
154 <!-- in a set, make sure we inherit the right book info... -->
155 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
156 <xsl:with-param name="recursive" select="true()"/>
157 </xsl:apply-templates>
160 <xsl:text>ar</xsl:text>
161 <xsl:number level="any" format="01" from="d:book"/>
162 <xsl:if test="not($recursive)">
163 <xsl:value-of select="$html.ext"/>
167 <xsl:when test="self::d:preface">
168 <xsl:if test="/d:set">
169 <!-- in a set, make sure we inherit the right book info... -->
170 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
171 <xsl:with-param name="recursive" select="true()"/>
172 </xsl:apply-templates>
175 <xsl:text>pr</xsl:text>
176 <xsl:number level="any" format="01" from="d:book"/>
177 <xsl:if test="not($recursive)">
178 <xsl:value-of select="$html.ext"/>
182 <xsl:when test="self::d:chapter">
183 <xsl:if test="/d:set">
184 <!-- in a set, make sure we inherit the right book info... -->
185 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
186 <xsl:with-param name="recursive" select="true()"/>
187 </xsl:apply-templates>
190 <xsl:text>ch</xsl:text>
191 <xsl:number level="any" format="01" from="d:book"/>
192 <xsl:if test="not($recursive)">
193 <xsl:value-of select="$html.ext"/>
197 <xsl:when test="self::d:appendix">
198 <xsl:if test="/d:set">
199 <!-- in a set, make sure we inherit the right book info... -->
200 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
201 <xsl:with-param name="recursive" select="true()"/>
202 </xsl:apply-templates>
205 <xsl:text>ap</xsl:text>
206 <xsl:number level="any" format="a" from="d:book"/>
207 <xsl:if test="not($recursive)">
208 <xsl:value-of select="$html.ext"/>
212 <xsl:when test="self::d:part">
214 <xsl:when test="/d:set">
215 <!-- in a set, make sure we inherit the right book info... -->
216 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
217 <xsl:with-param name="recursive" select="true()"/>
218 </xsl:apply-templates>
224 <xsl:text>pt</xsl:text>
225 <xsl:number level="any" format="01" from="d:book"/>
226 <xsl:if test="not($recursive)">
227 <xsl:value-of select="$html.ext"/>
231 <xsl:when test="self::d:reference">
233 <xsl:when test="/d:set">
234 <!-- in a set, make sure we inherit the right book info... -->
235 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
236 <xsl:with-param name="recursive" select="true()"/>
237 </xsl:apply-templates>
243 <xsl:text>rn</xsl:text>
244 <xsl:number level="any" format="01" from="d:book"/>
245 <xsl:if test="not($recursive)">
246 <xsl:value-of select="$html.ext"/>
250 <xsl:when test="self::d:refentry">
252 <xsl:when test="parent::d:reference">
253 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
254 <xsl:with-param name="recursive" select="true()"/>
255 </xsl:apply-templates>
258 <xsl:if test="/d:set">
259 <!-- in a set, make sure we inherit the right book info... -->
260 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
261 <xsl:with-param name="recursive" select="true()"/>
262 </xsl:apply-templates>
267 <xsl:text>re</xsl:text>
268 <xsl:number level="any" format="01" from="d:book"/>
269 <xsl:if test="not($recursive)">
270 <xsl:value-of select="$html.ext"/>
274 <xsl:when test="self::d:colophon">
276 <xsl:when test="/d:set">
277 <!-- in a set, make sure we inherit the right book info... -->
278 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
279 <xsl:with-param name="recursive" select="true()"/>
280 </xsl:apply-templates>
286 <xsl:text>co</xsl:text>
287 <xsl:number level="any" format="01" from="d:book"/>
288 <xsl:if test="not($recursive)">
289 <xsl:value-of select="$html.ext"/>
293 <xsl:when test="self::d:sect1 or self::d:sect2 or self::d:sect3 or self::d:sect4 or self::d:sect5 or self::d:section">
294 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
295 <xsl:with-param name="recursive" select="true()"/>
296 </xsl:apply-templates>
297 <xsl:text>s</xsl:text>
298 <xsl:number format="01"/>
299 <xsl:if test="not($recursive)">
300 <xsl:value-of select="$html.ext"/>
304 <xsl:when test="self::d:bibliography">
306 <xsl:when test="/d:set">
307 <!-- in a set, make sure we inherit the right book info... -->
308 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
309 <xsl:with-param name="recursive" select="true()"/>
310 </xsl:apply-templates>
316 <xsl:text>bi</xsl:text>
317 <xsl:number level="any" format="01" from="d:book"/>
318 <xsl:if test="not($recursive)">
319 <xsl:value-of select="$html.ext"/>
323 <xsl:when test="self::d:glossary">
325 <xsl:when test="/d:set">
326 <!-- in a set, make sure we inherit the right book info... -->
327 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
328 <xsl:with-param name="recursive" select="true()"/>
329 </xsl:apply-templates>
335 <xsl:text>go</xsl:text>
336 <xsl:number level="any" format="01" from="d:book"/>
337 <xsl:if test="not($recursive)">
338 <xsl:value-of select="$html.ext"/>
342 <xsl:when test="self::d:index">
344 <xsl:when test="/d:set">
345 <!-- in a set, make sure we inherit the right book info... -->
346 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
347 <xsl:with-param name="recursive" select="true()"/>
348 </xsl:apply-templates>
354 <xsl:text>ix</xsl:text>
355 <xsl:number level="any" format="01" from="d:book"/>
356 <xsl:if test="not($recursive)">
357 <xsl:value-of select="$html.ext"/>
361 <xsl:when test="self::d:setindex">
362 <xsl:text>si</xsl:text>
363 <xsl:number level="any" format="01" from="d:set"/>
364 <xsl:if test="not($recursive)">
365 <xsl:value-of select="$html.ext"/>
369 <xsl:when test="self::d:topic">
371 <xsl:when test="/d:set">
372 <!-- in a set, make sure we inherit the right book info... -->
373 <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
374 <xsl:with-param name="recursive" select="true()"/>
375 </xsl:apply-templates>
381 <xsl:text>to</xsl:text>
382 <xsl:number level="any" format="01" from="d:book"/>
383 <xsl:if test="not($recursive)">
384 <xsl:value-of select="$html.ext"/>
389 <xsl:text>chunk-filename-error-</xsl:text>
390 <xsl:value-of select="name(.)"/>
391 <xsl:number level="any" format="01" from="d:set"/>
392 <xsl:if test="not($recursive)">
393 <xsl:value-of select="$html.ext"/>
399 <!-- ==================================================================== -->
403 <xsl:template match="processing-instruction('dbhtml')">
407 <!-- ==================================================================== -->
410 <xsl:template match="*" mode="find.chunks">
411 <xsl:variable name="chunk">
412 <xsl:call-template name="chunk"/>
416 <xsl:when test="$chunk != 0">
417 <cf:div id="{generate-id()}">
418 <xsl:apply-templates select="." mode="class.attribute"/>
419 <xsl:apply-templates select="*" mode="find.chunks"/>
423 <xsl:apply-templates select="*" mode="find.chunks"/>
428 <!-- Leave legalnotice chunk out of the list for Next and Prev -->
429 <xsl:template match="d:legalnotice" mode="find.chunks"/>
431 <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="with.namespace"><xslo:apply-templates select="/*" mode="addNS"/></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. add</xslo:text></xslo:with-param><xslo:with-param name="message"><xslo:text>added namespace before processing</xslo:text></xslo:with-param></xslo:call-template><xslo:apply-templates select="exslt:node-set($with.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="/">
432 <!-- * Get a title for current doc so that we let the user -->
433 <!-- * know what document we are processing at this point. -->
434 <xsl:variable name="doc.title">
435 <xsl:call-template name="get.doc.title"/>
438 <xsl:when test="false()"/>
439 <!-- Can't process unless namespace fixed with exsl node-set()-->
440 <xsl:when test="false()"/>
443 <xsl:when test="$rootid != ''">
445 <xsl:when test="count($profiled-nodes//*[@id=$rootid or @xml:id=$rootid]) = 0">
446 <xsl:message terminate="yes">
447 <xsl:text>ID '</xsl:text>
448 <xsl:value-of select="$rootid"/>
449 <xsl:text>' not found in document.</xsl:text>
453 <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
454 <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
456 <xsl:if test="$collect.xref.targets != 'only'">
457 <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid or @xml:id=$rootid]" mode="process.root"/>
458 <xsl:if test="$tex.math.in.alt != ''">
459 <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid or @xml:id=$rootid]" mode="collect.tex.math"/>
461 <xsl:if test="$generate.manifest != 0">
462 <xsl:call-template name="generate.manifest">
463 <xsl:with-param name="node" select="key('id',$rootid)"/>
471 <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
472 <xsl:apply-templates select="$profiled-nodes" mode="collect.targets"/>
474 <xsl:if test="$collect.xref.targets != 'only'">
475 <xsl:apply-templates select="$profiled-nodes" mode="process.root"/>
476 <xsl:if test="$tex.math.in.alt != ''">
477 <xsl:apply-templates select="$profiled-nodes" mode="collect.tex.math"/>
479 <xsl:if test="$generate.manifest != 0">
480 <xsl:call-template name="generate.manifest">
481 <xsl:with-param name="node" select="$profiled-nodes"/>
491 <xsl:template match="*" mode="process.root">
492 <xsl:apply-templates select="."/>
493 <xsl:call-template name="generate.css.files"/>
496 <!-- ====================================================================== -->
498 <xsl:template match="d:set|d:book|d:part|d:preface|d:chapter|d:appendix |d:article |d:topic |d:reference|d:refentry |d:book/d:glossary|d:article/d:glossary|d:part/d:glossary |d:book/d:bibliography|d:article/d:bibliography|d:part/d:bibliography |d:colophon">
500 <xsl:when test="$onechunk != 0 and parent::*">
504 <xsl:call-template name="process-chunk-element"/>
509 <xsl:template match="d:sect1|d:sect2|d:sect3|d:sect4|d:sect5|d:section">
510 <xsl:variable name="ischunk">
511 <xsl:call-template name="chunk"/>
515 <xsl:when test="not(parent::*)">
516 <xsl:call-template name="process-chunk-element"/>
518 <xsl:when test="$ischunk = 0">
522 <xsl:call-template name="process-chunk-element"/>
527 <xsl:template match="d:setindex |d:book/d:index |d:article/d:index |d:part/d:index">
528 <!-- some implementations use completely empty index tags to indicate -->
529 <!-- where an automatically generated index should be inserted. so -->
530 <!-- if the index is completely empty, skip it. -->
531 <xsl:if test="count(*)>0 or $generate.index != '0'">
532 <xsl:call-template name="process-chunk-element"/>
536 <!-- Resolve xml:base attributes -->
537 <xsl:template match="@fileref">
538 <!-- need a check for absolute urls -->
540 <xsl:when test="contains(., ':')">
541 <!-- it has a uri scheme so it is an absolute uri -->
542 <xsl:value-of select="."/>
544 <xsl:when test="$keep.relative.image.uris != 0">
545 <!-- leave it alone -->
546 <xsl:value-of select="."/>
549 <!-- its a relative uri -->
550 <xsl:call-template name="relative-uri">
551 <xsl:with-param name="destdir">
552 <xsl:call-template name="dbhtml-dir">
553 <xsl:with-param name="context" select=".."/>
561 <!-- ==================================================================== -->
562 <xsl:template match="d:set|d:book|d:part|d:preface|d:chapter|d:appendix |d:article |d:topic |d:reference|d:refentry |d:sect1|d:sect2|d:sect3|d:sect4|d:sect5 |d:section |d:book/d:glossary|d:article/d:glossary|d:part/d:glossary |d:book/d:bibliography|d:article/d:bibliography|d:part/d:bibliography |d:colophon" mode="enumerate-files">
563 <xsl:variable name="ischunk"><xsl:call-template name="chunk"/></xsl:variable>
564 <xsl:if test="$ischunk='1'">
565 <xsl:call-template name="make-relative-filename">
566 <xsl:with-param name="base.dir">
567 <xsl:if test="$manifest.in.base.dir = 0">
568 <xsl:value-of select="$chunk.base.dir"/>
571 <xsl:with-param name="base.name">
572 <xsl:apply-templates mode="chunk-filename" select="."/>
578 <xsl:apply-templates select="*" mode="enumerate-files"/>
581 <xsl:template match="d:book/d:index|d:article/d:index|d:part/d:index" mode="enumerate-files">
582 <xsl:if test="$htmlhelp.output != 1">
583 <xsl:variable name="ischunk"><xsl:call-template name="chunk"/></xsl:variable>
584 <xsl:if test="$ischunk='1'">
585 <xsl:call-template name="make-relative-filename">
586 <xsl:with-param name="base.dir">
587 <xsl:if test="$manifest.in.base.dir = 0">
588 <xsl:value-of select="$chunk.base.dir"/>
591 <xsl:with-param name="base.name">
592 <xsl:apply-templates mode="chunk-filename" select="."/>
598 <xsl:apply-templates select="*" mode="enumerate-files"/>
602 <xsl:template match="d:legalnotice" mode="enumerate-files">
603 <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
604 <xsl:if test="$generate.legalnotice.link != 0">
605 <xsl:call-template name="make-relative-filename">
606 <xsl:with-param name="base.dir">
607 <xsl:if test="$manifest.in.base.dir = 0">
608 <xsl:value-of select="$chunk.base.dir"/>
611 <xsl:with-param name="base.name">
612 <xsl:apply-templates mode="chunk-filename" select="."/>
620 <xsl:template match="d:revhistory" mode="enumerate-files">
621 <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
622 <xsl:if test="$generate.revhistory.link != 0">
623 <xsl:call-template name="make-relative-filename">
624 <xsl:with-param name="base.dir">
625 <xsl:if test="$manifest.in.base.dir = 0">
626 <xsl:value-of select="$chunk.base.dir"/>
629 <xsl:with-param name="base.name">
630 <xsl:call-template name="ln.or.rh.filename">
631 <xsl:with-param name="is.ln" select="false()"/>
640 <xsl:template match="d:mediaobject[d:imageobject] | d:inlinemediaobject[d:imageobject]" mode="enumerate-files">
641 <xsl:variable name="longdesc.uri">
642 <xsl:call-template name="longdesc.uri">
643 <xsl:with-param name="mediaobject" select="."/>
646 <xsl:variable name="mediaobject" select="."/>
648 <xsl:if test="$html.longdesc != 0 and $mediaobject/d:textobject[not(d:phrase)]">
649 <xsl:call-template name="longdesc.uri">
650 <xsl:with-param name="mediaobject" select="$mediaobject"/>
657 <xsl:template match="text()" mode="enumerate-files">