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:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0" xmlns:ng="http://docbook.org/docbook-ng" xmlns:db="http://docbook.org/ns/docbook" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="exsl cf ng db">
6 <!-- ********************************************************************
7 $Id: chunk-common.xsl 8551 2009-12-07 06:03:50Z bobstayton $
8 ********************************************************************
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://docbook.sf.net/release/xsl/current/ for
12 copyright and other information.
14 ******************************************************************** -->
16 <!-- ==================================================================== -->
18 <xsl:param name="onechunk" select="0"/>
19 <xsl:param name="refentry.separator" select="0"/>
20 <xsl:param name="chunk.fast" select="0"/>
22 <xsl:key name="genid" match="*" use="generate-id()"/>
24 <!-- ==================================================================== -->
26 <xsl:variable name="chunk.hierarchy">
27 <xsl:if test="$chunk.fast != 0">
29 <xsl:when test="$exsl.node.set.available != 0">
30 <xsl:message>Computing chunks...</xsl:message>
31 <xsl:apply-templates select="/*" mode="find.chunks"/>
35 <xsl:text>Fast chunking requires exsl:node-set(). </xsl:text>
36 <xsl:text>Using "slow" chunking.</xsl:text>
43 <!-- ==================================================================== -->
45 <xsl:template name="process-chunk-element">
46 <xsl:param name="content">
51 <xsl:when test="$chunk.fast != 0 and $exsl.node.set.available != 0">
52 <xsl:variable name="chunks" select="exsl:node-set($chunk.hierarchy)//cf:div"/>
53 <xsl:variable name="genid" select="generate-id()"/>
55 <xsl:variable name="div" select="$chunks[@id=$genid or @xml:id=$genid]"/>
57 <xsl:variable name="prevdiv" select="($div/preceding-sibling::cf:div|$div/preceding::cf:div|$div/parent::cf:div)[last()]"/>
58 <xsl:variable name="prev" select="key('genid', ($prevdiv/@id|$prevdiv/@xml:id)[1])"/>
60 <xsl:variable name="nextdiv" select="($div/following-sibling::cf:div|$div/following::cf:div|$div/cf:div)[1]"/>
61 <xsl:variable name="next" select="key('genid', ($nextdiv/@id|$nextdiv/@xml:id)[1])"/>
64 <xsl:when test="$onechunk != 0 and parent::*">
65 <xsl:copy-of select="$content"/>
68 <xsl:call-template name="process-chunk">
69 <xsl:with-param name="prev" select="$prev"/>
70 <xsl:with-param name="next" select="$next"/>
71 <xsl:with-param name="content" select="$content"/>
78 <xsl:when test="$onechunk != 0 and not(parent::*)">
79 <xsl:call-template name="chunk-all-sections">
80 <xsl:with-param name="content" select="$content"/>
83 <xsl:when test="$onechunk != 0">
84 <xsl:copy-of select="$content"/>
86 <xsl:when test="$chunk.first.sections = 0">
87 <xsl:call-template name="chunk-first-section-with-parent">
88 <xsl:with-param name="content" select="$content"/>
92 <xsl:call-template name="chunk-all-sections">
93 <xsl:with-param name="content" select="$content"/>
101 <xsl:template name="process-chunk">
102 <xsl:param name="prev" select="."/>
103 <xsl:param name="next" select="."/>
104 <xsl:param name="content">
108 <xsl:variable name="ischunk">
109 <xsl:call-template name="chunk"/>
112 <xsl:variable name="chunkfn">
113 <xsl:if test="$ischunk='1'">
114 <xsl:apply-templates mode="chunk-filename" select="."/>
118 <xsl:if test="$ischunk='0'">
120 <xsl:text>Error </xsl:text>
121 <xsl:value-of select="name(.)"/>
122 <xsl:text> is not a chunk!</xsl:text>
126 <xsl:variable name="filename">
127 <xsl:call-template name="make-relative-filename">
128 <xsl:with-param name="base.dir" select="$base.dir"/>
129 <xsl:with-param name="base.name" select="$chunkfn"/>
133 <xsl:call-template name="write.chunk">
134 <xsl:with-param name="filename" select="$filename"/>
135 <xsl:with-param name="content">
136 <xsl:call-template name="chunk-element-content">
137 <xsl:with-param name="prev" select="$prev"/>
138 <xsl:with-param name="next" select="$next"/>
139 <xsl:with-param name="content" select="$content"/>
142 <xsl:with-param name="quiet" select="$chunk.quietly"/>
146 <xsl:template name="chunk-first-section-with-parent">
147 <xsl:param name="content">
151 <!-- These xpath expressions are really hairy. The trick is to pick sections -->
152 <!-- that are not first children and are not the children of first children -->
154 <!-- Break these variables into pieces to work around
155 http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6063 -->
157 <xsl:variable name="prev-v1" select="(ancestor::sect1[$chunk.section.depth > 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect1][1] |ancestor::sect2[$chunk.section.depth > 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |ancestor::sect3[$chunk.section.depth > 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |ancestor::sect4[$chunk.section.depth > 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |ancestor::sect5[$chunk.section.depth > 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect5 and parent::sect4[preceding-sibling::sect4] and ancestor::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |ancestor::section[$chunk.section.depth > count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and not(ancestor::section[not(preceding-sibling::section)])][1])[last()]"/>
159 <xsl:variable name="prev-v2" select="(preceding::sect1[$chunk.section.depth > 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect1][1] |preceding::sect2[$chunk.section.depth > 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |preceding::sect3[$chunk.section.depth > 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |preceding::sect4[$chunk.section.depth > 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |preceding::sect5[$chunk.section.depth > 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect5 and parent::sect4[preceding-sibling::sect4] and ancestor::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |preceding::section[$chunk.section.depth > count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::section and not(ancestor::section[not(preceding-sibling::section)])][1])[last()]"/>
161 <xsl:variable name="prev" select="(preceding::book[1] |preceding::preface[1] |preceding::chapter[1] |preceding::appendix[1] |preceding::part[1] |preceding::reference[1] |preceding::refentry[1] |preceding::colophon[1] |preceding::article[1] |preceding::bibliography[parent::article or parent::book or parent::part][1] |preceding::glossary[parent::article or parent::book or parent::part][1] |preceding::index[$generate.index != 0] [parent::article or parent::book or parent::part][1] |preceding::setindex[$generate.index != 0][1] |ancestor::set |ancestor::book[1] |ancestor::preface[1] |ancestor::chapter[1] |ancestor::appendix[1] |ancestor::part[1] |ancestor::reference[1] |ancestor::article[1] |$prev-v1 |$prev-v2)[last()]"/>
163 <xsl:variable name="next-v1" select="(following::sect1[$chunk.section.depth > 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect1][1] |following::sect2[$chunk.section.depth > 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |following::sect3[$chunk.section.depth > 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |following::sect4[$chunk.section.depth > 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |following::sect5[$chunk.section.depth > 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect5 and parent::sect4[preceding-sibling::sect4] and ancestor::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |following::section[$chunk.section.depth > count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::section and not(ancestor::section[not(preceding-sibling::section)])][1])[1]"/>
165 <xsl:variable name="next-v2" select="(descendant::sect1[$chunk.section.depth > 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect1][1] |descendant::sect2[$chunk.section.depth > 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |descendant::sect3[$chunk.section.depth > 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |descendant::sect4[$chunk.section.depth > 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |descendant::sect5[$chunk.section.depth > 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::sect5 and parent::sect4[preceding-sibling::sect4] and ancestor::sect3[preceding-sibling::sect3] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |descendant::section[$chunk.section.depth > count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking']) and preceding-sibling::section and not(ancestor::section[not(preceding-sibling::section)])])[1]"/>
167 <xsl:variable name="next" select="(following::book[1] |following::preface[1] |following::chapter[1] |following::appendix[1] |following::part[1] |following::reference[1] |following::refentry[1] |following::colophon[1] |following::bibliography[parent::article or parent::book or parent::part][1] |following::glossary[parent::article or parent::book or parent::part][1] |following::index[$generate.index != 0] [parent::article or parent::book or parent::part][1] |following::article[1] |following::setindex[$generate.index != 0][1] |descendant::book[1] |descendant::preface[1] |descendant::chapter[1] |descendant::appendix[1] |descendant::article[1] |descendant::bibliography[parent::article or parent::book or parent::part][1] |descendant::glossary[parent::article or parent::book or parent::part][1] |descendant::index[$generate.index != 0] [parent::article or parent::book or parent::part][1] |descendant::colophon[1] |descendant::setindex[$generate.index != 0][1] |descendant::part[1] |descendant::reference[1] |descendant::refentry[1] |$next-v1 |$next-v2)[1]"/>
169 <xsl:call-template name="process-chunk">
170 <xsl:with-param name="prev" select="$prev"/>
171 <xsl:with-param name="next" select="$next"/>
172 <xsl:with-param name="content" select="$content"/>
176 <xsl:template name="chunk-all-sections">
177 <xsl:param name="content">
181 <xsl:variable name="prev-v1" select="(preceding::sect1[$chunk.section.depth > 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |preceding::sect2[$chunk.section.depth > 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |preceding::sect3[$chunk.section.depth > 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |preceding::sect4[$chunk.section.depth > 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |preceding::sect5[$chunk.section.depth > 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |preceding::section[$chunk.section.depth > count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1])[last()]"/>
183 <xsl:variable name="prev-v2" select="(ancestor::sect1[$chunk.section.depth > 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |ancestor::sect2[$chunk.section.depth > 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |ancestor::sect3[$chunk.section.depth > 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |ancestor::sect4[$chunk.section.depth > 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |ancestor::sect5[$chunk.section.depth > 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |ancestor::section[$chunk.section.depth > count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1])[last()]"/>
185 <xsl:variable name="prev" select="(preceding::book[1] |preceding::preface[1] |preceding::chapter[1] |preceding::appendix[1] |preceding::part[1] |preceding::reference[1] |preceding::refentry[1] |preceding::colophon[1] |preceding::article[1] |preceding::bibliography[parent::article or parent::book or parent::part][1] |preceding::glossary[parent::article or parent::book or parent::part][1] |preceding::index[$generate.index != 0] [parent::article or parent::book or parent::part][1] |preceding::setindex[$generate.index != 0][1] |ancestor::set |ancestor::book[1] |ancestor::preface[1] |ancestor::chapter[1] |ancestor::appendix[1] |ancestor::part[1] |ancestor::reference[1] |ancestor::article[1] |$prev-v1 |$prev-v2)[last()]"/>
187 <xsl:variable name="next-v1" select="(following::sect1[$chunk.section.depth > 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |following::sect2[$chunk.section.depth > 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |following::sect3[$chunk.section.depth > 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |following::sect4[$chunk.section.depth > 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |following::sect5[$chunk.section.depth > 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |following::section[$chunk.section.depth > count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1])[1]"/>
189 <xsl:variable name="next-v2" select="(descendant::sect1[$chunk.section.depth > 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |descendant::sect2[$chunk.section.depth > 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |descendant::sect3[$chunk.section.depth > 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |descendant::sect4[$chunk.section.depth > 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |descendant::sect5[$chunk.section.depth > 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1] |descendant::section[$chunk.section.depth > count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1])[1]"/>
191 <xsl:variable name="next" select="(following::book[1] |following::preface[1] |following::chapter[1] |following::appendix[1] |following::part[1] |following::reference[1] |following::refentry[1] |following::colophon[1] |following::bibliography[parent::article or parent::book or parent::part][1] |following::glossary[parent::article or parent::book or parent::part][1] |following::index[$generate.index != 0] [parent::article or parent::book][1] |following::article[1] |following::setindex[$generate.index != 0][1] |descendant::book[1] |descendant::preface[1] |descendant::chapter[1] |descendant::appendix[1] |descendant::article[1] |descendant::bibliography[parent::article or parent::book][1] |descendant::glossary[parent::article or parent::book or parent::part][1] |descendant::index[$generate.index != 0] [parent::article or parent::book][1] |descendant::colophon[1] |descendant::setindex[$generate.index != 0][1] |descendant::part[1] |descendant::reference[1] |descendant::refentry[1] |$next-v1 |$next-v2)[1]"/>
193 <xsl:call-template name="process-chunk">
194 <xsl:with-param name="prev" select="$prev"/>
195 <xsl:with-param name="next" select="$next"/>
196 <xsl:with-param name="content" select="$content"/>
200 <!-- ==================================================================== -->
202 <!-- ==================================================================== -->
204 <xsl:template name="make.lots">
205 <xsl:param name="toc.params" select="''"/>
206 <xsl:param name="toc"/>
208 <xsl:variable name="lots">
209 <xsl:if test="contains($toc.params, 'toc')">
210 <xsl:copy-of select="$toc"/>
213 <xsl:if test="contains($toc.params, 'figure')">
215 <xsl:when test="$chunk.separate.lots != '0'">
216 <xsl:call-template name="make.lot.chunk">
217 <xsl:with-param name="type" select="'figure'"/>
218 <xsl:with-param name="lot">
219 <xsl:call-template name="list.of.titles">
220 <xsl:with-param name="titles" select="'figure'"/>
221 <xsl:with-param name="nodes" select=".//figure"/>
227 <xsl:call-template name="list.of.titles">
228 <xsl:with-param name="titles" select="'figure'"/>
229 <xsl:with-param name="nodes" select=".//figure"/>
235 <xsl:if test="contains($toc.params, 'table')">
237 <xsl:when test="$chunk.separate.lots != '0'">
238 <xsl:call-template name="make.lot.chunk">
239 <xsl:with-param name="type" select="'table'"/>
240 <xsl:with-param name="lot">
241 <xsl:call-template name="list.of.titles">
242 <xsl:with-param name="titles" select="'table'"/>
243 <xsl:with-param name="nodes" select=".//table"/>
249 <xsl:call-template name="list.of.titles">
250 <xsl:with-param name="titles" select="'table'"/>
251 <xsl:with-param name="nodes" select=".//table"/>
257 <xsl:if test="contains($toc.params, 'example')">
259 <xsl:when test="$chunk.separate.lots != '0'">
260 <xsl:call-template name="make.lot.chunk">
261 <xsl:with-param name="type" select="'example'"/>
262 <xsl:with-param name="lot">
263 <xsl:call-template name="list.of.titles">
264 <xsl:with-param name="titles" select="'example'"/>
265 <xsl:with-param name="nodes" select=".//example"/>
271 <xsl:call-template name="list.of.titles">
272 <xsl:with-param name="titles" select="'example'"/>
273 <xsl:with-param name="nodes" select=".//example"/>
279 <xsl:if test="contains($toc.params, 'equation')">
281 <xsl:when test="$chunk.separate.lots != '0'">
282 <xsl:call-template name="make.lot.chunk">
283 <xsl:with-param name="type" select="'equation'"/>
284 <xsl:with-param name="lot">
285 <xsl:call-template name="list.of.titles">
286 <xsl:with-param name="titles" select="'equation'"/>
287 <xsl:with-param name="nodes" select=".//equation[title or info/title]"/>
293 <xsl:call-template name="list.of.titles">
294 <xsl:with-param name="titles" select="'equation'"/>
295 <xsl:with-param name="nodes" select=".//equation[title or info/title]"/>
301 <xsl:if test="contains($toc.params, 'procedure')">
303 <xsl:when test="$chunk.separate.lots != '0'">
304 <xsl:call-template name="make.lot.chunk">
305 <xsl:with-param name="type" select="'procedure'"/>
306 <xsl:with-param name="lot">
307 <xsl:call-template name="list.of.titles">
308 <xsl:with-param name="titles" select="'procedure'"/>
309 <xsl:with-param name="nodes" select=".//procedure[title]"/>
315 <xsl:call-template name="list.of.titles">
316 <xsl:with-param name="titles" select="'procedure'"/>
317 <xsl:with-param name="nodes" select=".//procedure[title]"/>
324 <xsl:if test="string($lots) != ''">
326 <xsl:when test="$chunk.tocs.and.lots != 0 and not(parent::*)">
327 <xsl:call-template name="write.chunk">
328 <xsl:with-param name="filename">
329 <xsl:call-template name="make-relative-filename">
330 <xsl:with-param name="base.dir" select="$base.dir"/>
331 <xsl:with-param name="base.name">
332 <xsl:call-template name="dbhtml-dir"/>
333 <xsl:apply-templates select="." mode="recursive-chunk-filename">
334 <xsl:with-param name="recursive" select="true()"/>
335 </xsl:apply-templates>
336 <xsl:text>-toc</xsl:text>
337 <xsl:value-of select="$html.ext"/>
341 <xsl:with-param name="content">
342 <xsl:call-template name="chunk-element-content">
343 <xsl:with-param name="prev" select="/foo"/>
344 <xsl:with-param name="next" select="/foo"/>
345 <xsl:with-param name="nav.context" select="'toc'"/>
346 <xsl:with-param name="content">
347 <xsl:if test="$chunk.tocs.and.lots.has.title != 0">
349 <xsl:apply-templates select="." mode="object.title.markup"/>
352 <xsl:copy-of select="$lots"/>
356 <xsl:with-param name="quiet" select="$chunk.quietly"/>
360 <xsl:copy-of select="$lots"/>
366 <xsl:template name="make.lot.chunk">
367 <xsl:param name="type" select="''"/>
368 <xsl:param name="lot"/>
370 <xsl:if test="string($lot) != ''">
371 <xsl:variable name="filename">
372 <xsl:call-template name="make-relative-filename">
373 <xsl:with-param name="base.dir" select="$base.dir"/>
374 <xsl:with-param name="base.name">
375 <xsl:call-template name="dbhtml-dir"/>
376 <xsl:value-of select="$type"/>
377 <xsl:text>-toc</xsl:text>
378 <xsl:value-of select="$html.ext"/>
383 <xsl:variable name="href">
384 <xsl:call-template name="make-relative-filename">
385 <xsl:with-param name="base.name">
386 <xsl:call-template name="dbhtml-dir"/>
387 <xsl:value-of select="$type"/>
388 <xsl:text>-toc</xsl:text>
389 <xsl:value-of select="$html.ext"/>
394 <xsl:call-template name="write.chunk">
395 <xsl:with-param name="filename" select="$filename"/>
396 <xsl:with-param name="content">
397 <xsl:call-template name="chunk-element-content">
398 <xsl:with-param name="prev" select="/foo"/>
399 <xsl:with-param name="next" select="/foo"/>
400 <xsl:with-param name="nav.context" select="'toc'"/>
401 <xsl:with-param name="content">
402 <xsl:copy-of select="$lot"/>
406 <xsl:with-param name="quiet" select="$chunk.quietly"/>
408 <!-- And output a link to this file -->
410 <xsl:attribute name="class">
411 <xsl:text>ListofTitles</xsl:text>
414 <xsl:call-template name="gentext">
415 <xsl:with-param name="key">
417 <xsl:when test="$type='table'">ListofTables</xsl:when>
418 <xsl:when test="$type='figure'">ListofFigures</xsl:when>
419 <xsl:when test="$type='equation'">ListofEquations</xsl:when>
420 <xsl:when test="$type='example'">ListofExamples</xsl:when>
421 <xsl:when test="$type='procedure'">ListofProcedures</xsl:when>
422 <xsl:otherwise>ListofUnknown</xsl:otherwise>
431 <!-- ==================================================================== -->
433 <xsl:template name="in.other.chunk">
434 <xsl:param name="chunk" select="."/>
435 <xsl:param name="node" select="."/>
437 <xsl:variable name="is.chunk">
438 <xsl:call-template name="chunk">
439 <xsl:with-param name="node" select="$node"/>
445 <xsl:text>in.other.chunk: </xsl:text>
446 <xsl:value-of select="name($chunk)"/>
447 <xsl:text> </xsl:text>
448 <xsl:value-of select="name($node)"/>
449 <xsl:text> </xsl:text>
450 <xsl:value-of select="$chunk = $node"/>
451 <xsl:text> </xsl:text>
452 <xsl:value-of select="$is.chunk"/>
457 <xsl:when test="$chunk = $node">0</xsl:when>
458 <xsl:when test="$is.chunk = 1">1</xsl:when>
459 <xsl:when test="count($node) = 0">0</xsl:when>
461 <xsl:call-template name="in.other.chunk">
462 <xsl:with-param name="chunk" select="$chunk"/>
463 <xsl:with-param name="node" select="$node/parent::*"/>
469 <xsl:template name="count.footnotes.in.this.chunk">
470 <xsl:param name="node" select="."/>
471 <xsl:param name="footnotes" select="$node//footnote"/>
472 <xsl:param name="count" select="0"/>
476 <xsl:text>count.footnotes.in.this.chunk: </xsl:text>
477 <xsl:value-of select="name($node)"/>
481 <xsl:variable name="in.other.chunk">
482 <xsl:call-template name="in.other.chunk">
483 <xsl:with-param name="chunk" select="$node"/>
484 <xsl:with-param name="node" select="$footnotes[1]"/>
489 <xsl:when test="count($footnotes) = 0">
490 <xsl:value-of select="$count"/>
494 <xsl:when test="$in.other.chunk != 0">
495 <xsl:call-template name="count.footnotes.in.this.chunk">
496 <xsl:with-param name="node" select="$node"/>
497 <xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
498 <xsl:with-param name="count" select="$count"/>
501 <xsl:when test="$footnotes[1]/ancestor::table |$footnotes[1]/ancestor::informaltable">
502 <xsl:call-template name="count.footnotes.in.this.chunk">
503 <xsl:with-param name="node" select="$node"/>
504 <xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
505 <xsl:with-param name="count" select="$count"/>
509 <xsl:call-template name="count.footnotes.in.this.chunk">
510 <xsl:with-param name="node" select="$node"/>
511 <xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
512 <xsl:with-param name="count" select="$count + 1"/>
520 <xsl:template name="process.footnotes.in.this.chunk">
521 <xsl:param name="node" select="."/>
522 <xsl:param name="footnotes" select="$node//footnote"/>
525 <xsl:message>process.footnotes.in.this.chunk</xsl:message>
528 <xsl:variable name="in.other.chunk">
529 <xsl:call-template name="in.other.chunk">
530 <xsl:with-param name="chunk" select="$node"/>
531 <xsl:with-param name="node" select="$footnotes[1]"/>
536 <xsl:when test="count($footnotes) = 0">
541 <xsl:when test="$in.other.chunk != 0">
542 <xsl:call-template name="process.footnotes.in.this.chunk">
543 <xsl:with-param name="node" select="$node"/>
544 <xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
547 <xsl:when test="$footnotes[1]/ancestor::table |$footnotes[1]/ancestor::informaltable">
548 <xsl:call-template name="process.footnotes.in.this.chunk">
549 <xsl:with-param name="node" select="$node"/>
550 <xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
554 <xsl:apply-templates select="$footnotes[1]" mode="process.footnote.mode"/>
555 <xsl:call-template name="process.footnotes.in.this.chunk">
556 <xsl:with-param name="node" select="$node"/>
557 <xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
565 <xsl:template name="process.footnotes">
566 <xsl:variable name="footnotes" select=".//footnote"/>
567 <xsl:variable name="fcount">
568 <xsl:call-template name="count.footnotes.in.this.chunk">
569 <xsl:with-param name="node" select="."/>
570 <xsl:with-param name="footnotes" select="$footnotes"/>
576 <xsl:value-of select="name(.)"/>
577 <xsl:text> fcount: </xsl:text>
578 <xsl:value-of select="$fcount"/>
582 <!-- Only bother to do this if there's at least one non-table footnote -->
583 <xsl:if test="$fcount > 0">
584 <div class="footnotes">
587 <xsl:call-template name="process.footnotes.in.this.chunk">
588 <xsl:with-param name="node" select="."/>
589 <xsl:with-param name="footnotes" select="$footnotes"/>
594 <!-- FIXME: When chunking, only the annotations actually used
595 in this chunk should be referenced. I don't think it
596 does any harm to reference them all, but it adds
597 unnecessary bloat to each chunk. -->
598 <xsl:if test="$annotation.support != 0 and //annotation">
599 <div class="annotation-list">
600 <div class="annotation-nocss">
601 <p>The following annotations are from this essay. You are seeing
602 them here because your browser doesn’t support the user-interface
603 techniques used to make them appear as ‘popups’ on modern browsers.</p>
606 <xsl:apply-templates select="//annotation" mode="annotation-popup"/>
611 <xsl:template name="process.chunk.footnotes">
612 <xsl:variable name="is.chunk">
613 <xsl:call-template name="chunk"/>
615 <xsl:if test="$is.chunk = 1">
616 <xsl:call-template name="process.footnotes"/>
620 <!-- ====================================================================== -->
622 <xsl:template name="chunk">
623 <xsl:param name="node" select="."/>
624 <!-- returns 1 if $node is a chunk -->
626 <!-- ==================================================================== -->
632 bibliography in article or part or book
636 glossary in article or part or book
637 index in article or part or book
642 sect{1,2,3,4,5} if position()>1 && depth < chunk.section.depth
643 section if position()>1 && depth < chunk.section.depth
647 <!-- ==================================================================== -->
651 <xsl:text>chunk: </xsl:text>
652 <xsl:value-of select="name($node)"/>
653 <xsl:text>(</xsl:text>
654 <xsl:value-of select="$node/@id"/>
655 <xsl:text>)</xsl:text>
656 <xsl:text> csd: </xsl:text>
657 <xsl:value-of select="$chunk.section.depth"/>
658 <xsl:text> cfs: </xsl:text>
659 <xsl:value-of select="$chunk.first.sections"/>
660 <xsl:text> ps: </xsl:text>
661 <xsl:value-of select="count($node/parent::section)"/>
662 <xsl:text> prs: </xsl:text>
663 <xsl:value-of select="count($node/preceding-sibling::section)"/>
668 <xsl:when test="$node/parent::*/processing-instruction('dbhtml')[normalize-space(.) = 'stop-chunking']">0</xsl:when>
669 <xsl:when test="not($node/parent::*)">1</xsl:when>
671 <xsl:when test="local-name($node) = 'sect1' and $chunk.section.depth >= 1 and ($chunk.first.sections != 0 or count($node/preceding-sibling::sect1) > 0)">
672 <xsl:text>1</xsl:text>
674 <xsl:when test="local-name($node) = 'sect2' and $chunk.section.depth >= 2 and ($chunk.first.sections != 0 or count($node/preceding-sibling::sect2) > 0)">
675 <xsl:call-template name="chunk">
676 <xsl:with-param name="node" select="$node/parent::*"/>
679 <xsl:when test="local-name($node) = 'sect3' and $chunk.section.depth >= 3 and ($chunk.first.sections != 0 or count($node/preceding-sibling::sect3) > 0)">
680 <xsl:call-template name="chunk">
681 <xsl:with-param name="node" select="$node/parent::*"/>
684 <xsl:when test="local-name($node) = 'sect4' and $chunk.section.depth >= 4 and ($chunk.first.sections != 0 or count($node/preceding-sibling::sect4) > 0)">
685 <xsl:call-template name="chunk">
686 <xsl:with-param name="node" select="$node/parent::*"/>
689 <xsl:when test="local-name($node) = 'sect5' and $chunk.section.depth >= 5 and ($chunk.first.sections != 0 or count($node/preceding-sibling::sect5) > 0)">
690 <xsl:call-template name="chunk">
691 <xsl:with-param name="node" select="$node/parent::*"/>
694 <xsl:when test="local-name($node) = 'section' and $chunk.section.depth >= count($node/ancestor::section)+1 and ($chunk.first.sections != 0 or count($node/preceding-sibling::section) > 0)">
695 <xsl:call-template name="chunk">
696 <xsl:with-param name="node" select="$node/parent::*"/>
700 <xsl:when test="local-name($node)='preface'">1</xsl:when>
701 <xsl:when test="local-name($node)='chapter'">1</xsl:when>
702 <xsl:when test="local-name($node)='appendix'">1</xsl:when>
703 <xsl:when test="local-name($node)='article'">1</xsl:when>
704 <xsl:when test="local-name($node)='part'">1</xsl:when>
705 <xsl:when test="local-name($node)='reference'">1</xsl:when>
706 <xsl:when test="local-name($node)='refentry'">1</xsl:when>
707 <xsl:when test="local-name($node)='index' and ($generate.index != 0 or count($node/*) > 0) and (local-name($node/parent::*) = 'article' or local-name($node/parent::*) = 'book' or local-name($node/parent::*) = 'part' )">1</xsl:when>
708 <xsl:when test="local-name($node)='bibliography' and (local-name($node/parent::*) = 'article' or local-name($node/parent::*) = 'book' or local-name($node/parent::*) = 'part' )">1</xsl:when>
709 <xsl:when test="local-name($node)='glossary' and (local-name($node/parent::*) = 'article' or local-name($node/parent::*) = 'book' or local-name($node/parent::*) = 'part' )">1</xsl:when>
710 <xsl:when test="local-name($node)='colophon'">1</xsl:when>
711 <xsl:when test="local-name($node)='book'">1</xsl:when>
712 <xsl:when test="local-name($node)='set'">1</xsl:when>
713 <xsl:when test="local-name($node)='setindex'">1</xsl:when>
714 <xsl:when test="local-name($node)='legalnotice' and $generate.legalnotice.link != 0">1</xsl:when>
715 <xsl:otherwise>0</xsl:otherwise>
719 <!-- ==================================================================== -->
720 <xsl:template name="href.target.uri">
721 <xsl:param name="object" select="."/>
722 <xsl:variable name="ischunk">
723 <xsl:call-template name="chunk">
724 <xsl:with-param name="node" select="$object"/>
728 <xsl:apply-templates mode="chunk-filename" select="$object"/>
730 <xsl:if test="$ischunk='0'">
731 <xsl:text>#</xsl:text>
732 <xsl:call-template name="object.id">
733 <xsl:with-param name="object" select="$object"/>
738 <xsl:template name="href.target">
739 <xsl:param name="context" select="."/>
740 <xsl:param name="object" select="."/>
741 <xsl:param name="toc-context" select="."/>
742 <!-- * If $toc-context contains some node other than the current node, -->
743 <!-- * it means we're processing a link in a TOC. In that case, to -->
744 <!-- * ensure the link will work correctly, we need to take a look at -->
745 <!-- * where the file containing the TOC will get written, and where -->
746 <!-- * the file that's being linked to will get written. -->
747 <xsl:variable name="toc-output-dir">
748 <xsl:if test="not($toc-context = .)">
749 <!-- * Get the $toc-context node and all its ancestors, look down -->
750 <!-- * through them to find the last/closest node to the -->
751 <!-- * toc-context node that has a "dbhtml dir" PI, and get the -->
752 <!-- * directory name from that. That's the name of the directory -->
753 <!-- * to which the current toc output file will get written. -->
754 <xsl:call-template name="dbhtml-dir">
755 <xsl:with-param name="context" select="$toc-context/ancestor-or-self::*[processing-instruction('dbhtml')[contains(.,'dir')]][last()]"/>
759 <xsl:variable name="linked-file-output-dir">
760 <xsl:if test="not($toc-context = .)">
761 <!-- * Get the current node and all its ancestors, look down -->
762 <!-- * through them to find the last/closest node to the current -->
763 <!-- * node that has a "dbhtml dir" PI, and get the directory name -->
764 <!-- * from that. That's the name of the directory to which the -->
765 <!-- * file that's being linked to will get written. -->
766 <xsl:call-template name="dbhtml-dir">
767 <xsl:with-param name="context" select="ancestor-or-self::*[processing-instruction('dbhtml')[contains(.,'dir')]][last()]"/>
771 <xsl:variable name="href.to.uri">
772 <xsl:call-template name="href.target.uri">
773 <xsl:with-param name="object" select="$object"/>
776 <xsl:variable name="href.from.uri">
778 <xsl:when test="not($toc-context = .)">
779 <xsl:call-template name="href.target.uri">
780 <xsl:with-param name="object" select="$toc-context"/>
784 <xsl:call-template name="href.target.uri">
785 <xsl:with-param name="object" select="$context"/>
790 <!-- * <xsl:message>toc-context: <xsl:value-of select="local-name($toc-context)"/></xsl:message> -->
791 <!-- * <xsl:message>node: <xsl:value-of select="local-name(.)"/></xsl:message> -->
792 <!-- * <xsl:message>context: <xsl:value-of select="local-name($context)"/></xsl:message> -->
793 <!-- * <xsl:message>object: <xsl:value-of select="local-name($object)"/></xsl:message> -->
794 <!-- * <xsl:message>toc-output-dir: <xsl:value-of select="$toc-output-dir"/></xsl:message> -->
795 <!-- * <xsl:message>linked-file-output-dir: <xsl:value-of select="$linked-file-output-dir"/></xsl:message> -->
796 <!-- * <xsl:message>href.to.uri: <xsl:value-of select="$href.to.uri"/></xsl:message> -->
797 <!-- * <xsl:message>href.from.uri: <xsl:value-of select="$href.from.uri"/></xsl:message> -->
798 <xsl:variable name="href.to">
800 <!-- * 2007-07-19, MikeSmith: Added the following conditional to -->
801 <!-- * deal with a problem case for links in TOCs. It checks to see -->
802 <!-- * if the output dir that a TOC will get written to is -->
803 <!-- * different from the output dir of the file being linked to. -->
804 <!-- * If it is different, we do not call trim.common.uri.paths. -->
806 <!-- * Reason why I added that conditional is: I ran into a bug for -->
807 <!-- * this case: -->
809 <!-- * 1. we are chunking into separate dirs -->
811 <!-- * 2. output for the TOC is written to current dir, but the file -->
812 <!-- * being linked to is written to some subdir "foo". -->
814 <!-- * For that case, links to that file in that TOC did not show -->
815 <!-- * the correct path - they omitted the "foo". -->
817 <!-- * The cause of that problem was that the trim.common.uri.paths -->
818 <!-- * template[1] was being called under all conditions. But it's -->
819 <!-- * apparent that we don't want to call trim.common.uri.paths in -->
820 <!-- * the case where a linked file is being written to a different -->
821 <!-- * directory than the TOC that contains the link, because doing -->
822 <!-- * so will cause a necessary (not redundant) directory-name -->
823 <!-- * part of the link to get inadvertently trimmed, resulting in -->
824 <!-- * a broken link to that file. Thus, added the conditional. -->
826 <!-- * [1] The purpose of the trim.common.uri.paths template is to -->
827 <!-- * prevent cases where, if we didn't call it, we end up with -->
828 <!-- * unnecessary, redundant directory names getting output; for -->
829 <!-- * example, "foo/foo/refname.html". -->
830 <xsl:when test="not($toc-output-dir = $linked-file-output-dir)">
831 <xsl:value-of select="$href.to.uri"/>
834 <xsl:call-template name="trim.common.uri.paths">
835 <xsl:with-param name="uriA" select="$href.to.uri"/>
836 <xsl:with-param name="uriB" select="$href.from.uri"/>
837 <xsl:with-param name="return" select="'A'"/>
842 <xsl:variable name="href.from">
843 <xsl:call-template name="trim.common.uri.paths">
844 <xsl:with-param name="uriA" select="$href.to.uri"/>
845 <xsl:with-param name="uriB" select="$href.from.uri"/>
846 <xsl:with-param name="return" select="'B'"/>
849 <xsl:variable name="depth">
850 <xsl:call-template name="count.uri.path.depth">
851 <xsl:with-param name="filename" select="$href.from"/>
854 <xsl:variable name="href">
855 <xsl:call-template name="copy-string">
856 <xsl:with-param name="string" select="'../'"/>
857 <xsl:with-param name="count" select="$depth"/>
859 <xsl:value-of select="$href.to"/>
863 <xsl:text>In </xsl:text>
864 <xsl:value-of select="name(.)"/>
865 <xsl:text> (</xsl:text>
866 <xsl:value-of select="$href.from"/>
867 <xsl:text>,</xsl:text>
868 <xsl:value-of select="$depth"/>
869 <xsl:text>) </xsl:text>
870 <xsl:value-of select="name($object)"/>
871 <xsl:text> href=</xsl:text>
872 <xsl:value-of select="$href"/>
875 <xsl:value-of select="$href"/>
878 <!-- Returns the complete olink href value if found -->
879 <!-- Must take into account any dbhtml dir of the chunk containing the olink -->
880 <xsl:template name="make.olink.href">
881 <xsl:param name="olink.key" select="''"/>
882 <xsl:param name="target.database"/>
884 <xsl:if test="$olink.key != ''">
885 <xsl:variable name="target.href">
886 <xsl:for-each select="$target.database">
887 <xsl:value-of select="key('targetptr-key', $olink.key)[1]/@href"/>
891 <!-- an olink starting point may be in a subdirectory, so need
892 the "from" reference point to compute a relative path -->
894 <xsl:variable name="from.href">
895 <xsl:call-template name="olink.from.uri">
896 <xsl:with-param name="target.database" select="$target.database"/>
897 <xsl:with-param name="object" select="."/>
898 <xsl:with-param name="object.targetdoc" select="$current.docid"/>
902 <!-- If the from.href has directory path, then must "../" upward
903 to document level -->
904 <xsl:variable name="upward.from.path">
905 <xsl:call-template name="upward.path">
906 <xsl:with-param name="path" select="$from.href"/>
910 <xsl:variable name="targetdoc">
911 <xsl:value-of select="substring-before($olink.key, '/')"/>
914 <!-- Does the target database use a sitemap? -->
915 <xsl:variable name="use.sitemap">
917 <xsl:when test="$target.database//sitemap">1</xsl:when>
918 <xsl:otherwise>0</xsl:otherwise>
923 <!-- Get the baseuri for this targetptr -->
924 <xsl:variable name="baseuri">
926 <!-- Does the database use a sitemap? -->
927 <xsl:when test="$use.sitemap != 0">
929 <!-- Was current.docid parameter set? -->
930 <xsl:when test="$current.docid != ''">
931 <!-- Was it found in the database? -->
932 <xsl:variable name="currentdoc.key">
933 <xsl:for-each select="$target.database">
934 <xsl:value-of select="key('targetdoc-key', $current.docid)/@targetdoc"/>
938 <xsl:when test="$currentdoc.key != ''">
939 <xsl:for-each select="$target.database">
940 <xsl:call-template name="targetpath">
941 <xsl:with-param name="dirnode" select="key('targetdoc-key', $current.docid)/parent::dir"/>
942 <xsl:with-param name="targetdoc" select="$targetdoc"/>
948 <xsl:text>Olink error: cannot compute relative </xsl:text>
949 <xsl:text>sitemap path because $current.docid '</xsl:text>
950 <xsl:value-of select="$current.docid"/>
951 <xsl:text>' not found in target database.</xsl:text>
958 <xsl:text>Olink warning: cannot compute relative </xsl:text>
959 <xsl:text>sitemap path without $current.docid parameter</xsl:text>
963 <!-- In either case, add baseuri from its document entry-->
964 <xsl:variable name="docbaseuri">
965 <xsl:for-each select="$target.database">
966 <xsl:value-of select="key('targetdoc-key', $targetdoc)/@baseuri"/>
969 <xsl:if test="$docbaseuri != ''">
970 <xsl:value-of select="$docbaseuri"/>
973 <!-- No database sitemap in use -->
975 <!-- Just use any baseuri from its document entry -->
976 <xsl:variable name="docbaseuri">
977 <xsl:for-each select="$target.database">
978 <xsl:value-of select="key('targetdoc-key', $targetdoc)/@baseuri"/>
981 <xsl:if test="$docbaseuri != ''">
982 <xsl:value-of select="$docbaseuri"/>
988 <!-- Form the href information -->
989 <xsl:if test="not(contains($baseuri, ':'))">
990 <!-- if not an absolute uri, add upward path from olink chunk -->
991 <xsl:value-of select="$upward.from.path"/>
994 <xsl:if test="$baseuri != ''">
995 <xsl:value-of select="$baseuri"/>
996 <xsl:if test="substring($target.href,1,1) != '#'">
997 <!--xsl:text>/</xsl:text-->
1000 <!-- optionally turn off frag for PDF references -->
1001 <xsl:if test="not($insert.olink.pdf.frag = 0 and translate(substring($baseuri, string-length($baseuri) - 3), 'PDF', 'pdf') = '.pdf' and starts-with($target.href, '#') )">
1002 <xsl:value-of select="$target.href"/>
1007 <!-- Computes "../" to reach top -->
1008 <xsl:template name="upward.path">
1009 <xsl:param name="path" select="''"/>
1011 <!-- Don't bother with absolute uris -->
1012 <xsl:when test="contains($path, ':')"/>
1013 <xsl:when test="starts-with($path, '/')"/>
1014 <xsl:when test="contains($path, '/')">
1015 <xsl:text>../</xsl:text>
1016 <xsl:call-template name="upward.path">
1017 <xsl:with-param name="path" select="substring-after($path, '/')"/>
1018 </xsl:call-template>
1024 <!-- ==================================================================== -->
1026 <xsl:template name="html.head">
1027 <xsl:param name="prev" select="/foo"/>
1028 <xsl:param name="next" select="/foo"/>
1029 <xsl:variable name="this" select="."/>
1030 <xsl:variable name="home" select="/*[1]"/>
1031 <xsl:variable name="up" select="parent::*"/>
1034 <xsl:call-template name="system.head.content"/>
1035 <xsl:call-template name="head.content"/>
1037 <xsl:if test="$home">
1039 <xsl:attribute name="href">
1040 <xsl:call-template name="href.target">
1041 <xsl:with-param name="object" select="$home"/>
1042 </xsl:call-template>
1044 <xsl:attribute name="title">
1045 <xsl:apply-templates select="$home" mode="object.title.markup.textonly"/>
1052 <xsl:attribute name="href">
1053 <xsl:call-template name="href.target">
1054 <xsl:with-param name="object" select="$up"/>
1055 </xsl:call-template>
1057 <xsl:attribute name="title">
1058 <xsl:apply-templates select="$up" mode="object.title.markup.textonly"/>
1063 <xsl:if test="$prev">
1065 <xsl:attribute name="href">
1066 <xsl:call-template name="href.target">
1067 <xsl:with-param name="object" select="$prev"/>
1068 </xsl:call-template>
1070 <xsl:attribute name="title">
1071 <xsl:apply-templates select="$prev" mode="object.title.markup.textonly"/>
1076 <xsl:if test="$next">
1078 <xsl:attribute name="href">
1079 <xsl:call-template name="href.target">
1080 <xsl:with-param name="object" select="$next"/>
1081 </xsl:call-template>
1083 <xsl:attribute name="title">
1084 <xsl:apply-templates select="$next" mode="object.title.markup.textonly"/>
1089 <xsl:if test="$html.extra.head.links != 0">
1090 <xsl:for-each select="//part |//reference |//preface |//chapter |//article |//refentry |//appendix[not(parent::article)]|appendix |//glossary[not(parent::article)]|glossary |//index[not(parent::article)]|index">
1091 <link rel="{local-name(.)}">
1092 <xsl:attribute name="href">
1093 <xsl:call-template name="href.target">
1094 <xsl:with-param name="context" select="$this"/>
1095 <xsl:with-param name="object" select="."/>
1096 </xsl:call-template>
1098 <xsl:attribute name="title">
1099 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
1104 <xsl:for-each select="section|sect1|refsection|refsect1">
1106 <xsl:attribute name="rel">
1108 <xsl:when test="local-name($this) = 'section' or local-name($this) = 'refsection'">
1109 <xsl:value-of select="'subsection'"/>
1112 <xsl:value-of select="'section'"/>
1116 <xsl:attribute name="href">
1117 <xsl:call-template name="href.target">
1118 <xsl:with-param name="context" select="$this"/>
1119 <xsl:with-param name="object" select="."/>
1120 </xsl:call-template>
1122 <xsl:attribute name="title">
1123 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
1128 <xsl:for-each select="sect2|sect3|sect4|sect5|refsect2|refsect3">
1129 <link rel="subsection">
1130 <xsl:attribute name="href">
1131 <xsl:call-template name="href.target">
1132 <xsl:with-param name="context" select="$this"/>
1133 <xsl:with-param name="object" select="."/>
1134 </xsl:call-template>
1136 <xsl:attribute name="title">
1137 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
1143 <!-- * if we have a legalnotice and user wants it output as a -->
1144 <!-- * separate page and $html.head.legalnotice.link.types is -->
1145 <!-- * non-empty, we generate a link or links for each value in -->
1146 <!-- * $html.head.legalnotice.link.types -->
1147 <xsl:if test="//legalnotice and not($generate.legalnotice.link = 0) and not($html.head.legalnotice.link.types = '')">
1148 <xsl:call-template name="make.legalnotice.head.links"/>
1151 <xsl:call-template name="user.head.content"/>
1155 <!-- ==================================================================== -->
1157 <xsl:template name="header.navigation">
1158 <xsl:param name="prev" select="/foo"/>
1159 <xsl:param name="next" select="/foo"/>
1160 <xsl:param name="nav.context"/>
1162 <xsl:variable name="home" select="/*[1]"/>
1163 <xsl:variable name="up" select="parent::*"/>
1165 <xsl:variable name="row1" select="$navig.showtitles != 0"/>
1166 <xsl:variable name="row2" select="count($prev) > 0 or (count($up) > 0 and generate-id($up) != generate-id($home) and $navig.showtitles != 0) or count($next) > 0"/>
1168 <xsl:if test="$suppress.navigation = '0' and $suppress.header.navigation = '0'">
1169 <div class="navheader">
1170 <xsl:if test="$row1 or $row2">
1171 <table width="100%" summary="Navigation header">
1172 <xsl:if test="$row1">
1174 <th colspan="3" align="center">
1175 <xsl:apply-templates select="." mode="object.title.markup"/>
1180 <xsl:if test="$row2">
1182 <td align="{$direction.align.start}">
1183 <xsl:if test="count($prev)>0">
1185 <xsl:attribute name="href">
1186 <xsl:call-template name="href.target">
1187 <xsl:with-param name="object" select="$prev"/>
1188 </xsl:call-template>
1190 <xsl:call-template name="navig.content">
1191 <xsl:with-param name="direction" select="'prev'"/>
1192 </xsl:call-template>
1195 <xsl:text> </xsl:text>
1197 <th width="60%" align="center">
1199 <xsl:when test="count($up) > 0 and generate-id($up) != generate-id($home) and $navig.showtitles != 0">
1200 <xsl:apply-templates select="$up" mode="object.title.markup"/>
1202 <xsl:otherwise> </xsl:otherwise>
1205 <td align="{$direction.align.end}">
1206 <xsl:text> </xsl:text>
1207 <xsl:if test="count($next)>0">
1209 <xsl:attribute name="href">
1210 <xsl:call-template name="href.target">
1211 <xsl:with-param name="object" select="$next"/>
1212 </xsl:call-template>
1214 <xsl:call-template name="navig.content">
1215 <xsl:with-param name="direction" select="'next'"/>
1216 </xsl:call-template>
1224 <xsl:if test="$header.rule != 0">
1231 <!-- ==================================================================== -->
1233 <xsl:template name="footer.navigation">
1234 <xsl:param name="prev" select="/foo"/>
1235 <xsl:param name="next" select="/foo"/>
1236 <xsl:param name="nav.context"/>
1238 <xsl:variable name="home" select="/*[1]"/>
1239 <xsl:variable name="up" select="parent::*"/>
1241 <xsl:variable name="row1" select="count($prev) > 0 or count($up) > 0 or count($next) > 0"/>
1243 <xsl:variable name="row2" select="($prev and $navig.showtitles != 0) or (generate-id($home) != generate-id(.) or $nav.context = 'toc') or ($chunk.tocs.and.lots != 0 and $nav.context != 'toc') or ($next and $navig.showtitles != 0)"/>
1245 <xsl:if test="$suppress.navigation = '0' and $suppress.footer.navigation = '0'">
1246 <div class="navfooter">
1247 <xsl:if test="$footer.rule != 0">
1251 <xsl:if test="$row1 or $row2">
1252 <table width="100%" summary="Navigation footer">
1253 <xsl:if test="$row1">
1255 <td align="{$direction.align.start}">
1256 <xsl:if test="count($prev)>0">
1258 <xsl:attribute name="href">
1259 <xsl:call-template name="href.target">
1260 <xsl:with-param name="object" select="$prev"/>
1261 </xsl:call-template>
1263 <xsl:call-template name="navig.content">
1264 <xsl:with-param name="direction" select="'prev'"/>
1265 </xsl:call-template>
1268 <xsl:text> </xsl:text>
1272 <xsl:when test="count($up)>0 and generate-id($up) != generate-id($home)">
1274 <xsl:attribute name="href">
1275 <xsl:call-template name="href.target">
1276 <xsl:with-param name="object" select="$up"/>
1277 </xsl:call-template>
1279 <xsl:call-template name="navig.content">
1280 <xsl:with-param name="direction" select="'up'"/>
1281 </xsl:call-template>
1284 <xsl:otherwise> </xsl:otherwise>
1287 <td align="{$direction.align.end}">
1288 <xsl:text> </xsl:text>
1289 <xsl:if test="count($next)>0">
1291 <xsl:attribute name="href">
1292 <xsl:call-template name="href.target">
1293 <xsl:with-param name="object" select="$next"/>
1294 </xsl:call-template>
1296 <xsl:call-template name="navig.content">
1297 <xsl:with-param name="direction" select="'next'"/>
1298 </xsl:call-template>
1305 <xsl:if test="$row2">
1307 <td align="{$direction.align.start}" valign="top">
1308 <xsl:if test="$navig.showtitles != 0">
1309 <xsl:apply-templates select="$prev" mode="object.title.markup"/>
1311 <xsl:text> </xsl:text>
1315 <xsl:when test="$home != . or $nav.context = 'toc'">
1317 <xsl:attribute name="href">
1318 <xsl:call-template name="href.target">
1319 <xsl:with-param name="object" select="$home"/>
1320 </xsl:call-template>
1322 <xsl:call-template name="navig.content">
1323 <xsl:with-param name="direction" select="'home'"/>
1324 </xsl:call-template>
1326 <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
1327 <xsl:text> | </xsl:text>
1330 <xsl:otherwise> </xsl:otherwise>
1333 <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
1335 <xsl:attribute name="href">
1336 <xsl:apply-templates select="/*[1]" mode="recursive-chunk-filename">
1337 <xsl:with-param name="recursive" select="true()"/>
1338 </xsl:apply-templates>
1339 <xsl:text>-toc</xsl:text>
1340 <xsl:value-of select="$html.ext"/>
1342 <xsl:call-template name="gentext">
1343 <xsl:with-param name="key" select="'nav-toc'"/>
1344 </xsl:call-template>
1348 <td align="{$direction.align.end}" valign="top">
1349 <xsl:text> </xsl:text>
1350 <xsl:if test="$navig.showtitles != 0">
1351 <xsl:apply-templates select="$next" mode="object.title.markup"/>
1362 <!-- ==================================================================== -->
1364 <xsl:template name="navig.content">
1365 <xsl:param name="direction" select="next"/>
1366 <xsl:variable name="navtext">
1368 <xsl:when test="$direction = 'prev'">
1369 <xsl:call-template name="gentext.nav.prev"/>
1371 <xsl:when test="$direction = 'next'">
1372 <xsl:call-template name="gentext.nav.next"/>
1374 <xsl:when test="$direction = 'up'">
1375 <xsl:call-template name="gentext.nav.up"/>
1377 <xsl:when test="$direction = 'home'">
1378 <xsl:call-template name="gentext.nav.home"/>
1381 <xsl:text>xxx</xsl:text>
1387 <xsl:when test="$navig.graphics != 0">
1389 <xsl:attribute name="src">
1390 <xsl:value-of select="$navig.graphics.path"/>
1391 <xsl:value-of select="$direction"/>
1392 <xsl:value-of select="$navig.graphics.extension"/>
1394 <xsl:attribute name="alt">
1395 <xsl:value-of select="$navtext"/>
1400 <xsl:value-of select="$navtext"/>
1405 <!-- ==================================================================== -->
1407 <!-- * The following template assumes that the first legalnotice -->
1408 <!-- * instance found in a document applies to the contents of the -->
1409 <!-- * entire document. It generates an HTML link in each chunk, back -->
1410 <!-- * to the file containing the contents of the first legalnotice. -->
1412 <!-- * Actually, it may generate multiple link instances in each chunk, -->
1413 <!-- * because it walks through the space-separated list of link -->
1414 <!-- * types specified in the $html.head.legalnotice.link.types param, -->
1415 <!-- * popping off link types and generating links for them until it -->
1416 <!-- * depletes the list. -->
1418 <xsl:template name="make.legalnotice.head.links">
1419 <!-- * the following ID is used as part of the legalnotice filename; -->
1420 <!-- * we need it in order to construct the filename for use in the -->
1421 <!-- * value of the href attribute on the link -->
1423 <xsl:param name="ln-node" select="(//legalnotice)[1]"/>
1425 <xsl:param name="linktype">
1427 <xsl:when test="contains($html.head.legalnotice.link.types, ' ')">
1428 <xsl:value-of select="normalize-space( substring-before($html.head.legalnotice.link.types, ' '))"/>
1431 <xsl:value-of select="$html.head.legalnotice.link.types"/>
1435 <xsl:param name="remaining.linktypes" select="concat( normalize-space( substring-after($html.head.legalnotice.link.types, ' ')),' ')"/>
1436 <xsl:if test="not($linktype = '')">
1438 <!-- Compute name of legalnotice file (see titlepage.xsl) -->
1439 <xsl:variable name="file">
1440 <xsl:call-template name="ln.or.rh.filename">
1441 <xsl:with-param name="node" select="$ln-node"/>
1442 </xsl:call-template>
1445 <link rel="{$linktype}">
1446 <xsl:attribute name="href">
1447 <xsl:value-of select="$file"/>
1449 <xsl:attribute name="title">
1450 <xsl:apply-templates select="(//legalnotice)[1]" mode="object.title.markup.textonly"/>
1453 <xsl:call-template name="make.legalnotice.head.links">
1454 <!-- * pop the next value off the list of link types -->
1455 <xsl:with-param name="linktype" select="substring-before($remaining.linktypes, ' ')"/>
1456 <!-- * remove the link type from the list of remaining link types -->
1457 <xsl:with-param name="remaining.linktypes" select="substring-after($remaining.linktypes, ' ')"/>
1458 </xsl:call-template>
1462 <!-- ==================================================================== -->
1463 <xsl:template name="chunk-element-content">
1464 <xsl:param name="prev"/>
1465 <xsl:param name="next"/>
1466 <xsl:param name="nav.context"/>
1467 <xsl:param name="content">
1468 <xsl:apply-imports/>
1471 <xsl:call-template name="user.preroot"/>
1474 <xsl:call-template name="html.head">
1475 <xsl:with-param name="prev" select="$prev"/>
1476 <xsl:with-param name="next" select="$next"/>
1477 </xsl:call-template>
1480 <xsl:call-template name="body.attributes"/>
1481 <xsl:call-template name="user.header.navigation"/>
1483 <xsl:call-template name="header.navigation">
1484 <xsl:with-param name="prev" select="$prev"/>
1485 <xsl:with-param name="next" select="$next"/>
1486 <xsl:with-param name="nav.context" select="$nav.context"/>
1487 </xsl:call-template>
1489 <xsl:call-template name="user.header.content"/>
1491 <xsl:copy-of select="$content"/>
1493 <xsl:call-template name="user.footer.content"/>
1495 <xsl:call-template name="footer.navigation">
1496 <xsl:with-param name="prev" select="$prev"/>
1497 <xsl:with-param name="next" select="$next"/>
1498 <xsl:with-param name="nav.context" select="$nav.context"/>
1499 </xsl:call-template>
1501 <xsl:call-template name="user.footer.navigation"/>
1504 <xsl:value-of select="$chunk.append"/>
1507 <!-- ==================================================================== -->
1508 <xsl:template name="generate.manifest">
1509 <xsl:param name="node" select="/"/>
1510 <xsl:call-template name="write.text.chunk">
1511 <xsl:with-param name="filename">
1512 <xsl:if test="$manifest.in.base.dir != 0">
1513 <xsl:value-of select="$base.dir"/>
1515 <xsl:value-of select="$manifest"/>
1517 <xsl:with-param name="method" select="'text'"/>
1518 <xsl:with-param name="content">
1519 <xsl:apply-templates select="$node" mode="enumerate-files"/>
1521 <xsl:with-param name="encoding" select="$chunker.output.encoding"/>
1522 </xsl:call-template>
1525 <!-- ==================================================================== -->
1527 <xsl:template name="dbhtml-dir">
1528 <xsl:param name="context" select="."/>
1529 <!-- directories are now inherited from previous levels -->
1530 <xsl:variable name="ppath">
1531 <xsl:if test="$context/parent::*">
1532 <xsl:call-template name="dbhtml-dir">
1533 <xsl:with-param name="context" select="$context/parent::*"/>
1534 </xsl:call-template>
1537 <xsl:variable name="path">
1538 <xsl:call-template name="pi.dbhtml_dir">
1539 <xsl:with-param name="node" select="$context"/>
1540 </xsl:call-template>
1543 <xsl:when test="$path = ''">
1544 <xsl:if test="$ppath != ''">
1545 <xsl:value-of select="$ppath"/>
1549 <xsl:if test="$ppath != ''">
1550 <xsl:value-of select="$ppath"/>
1551 <xsl:if test="substring($ppath, string-length($ppath), 1) != '/'">
1552 <xsl:text>/</xsl:text>
1555 <xsl:value-of select="$path"/>
1556 <xsl:text>/</xsl:text>