1 <?xml version="1.0" encoding="US-ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets. Do not edit this file.-->
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 <!-- ********************************************************************
8 ********************************************************************
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://nwalsh.com/docbook/xsl/ for copyright
12 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="function-available('exsl:node-set')">
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 <xsl:template match="*" mode="find.chunks">
44 <xsl:variable name="chunk">
45 <xsl:call-template name="chunk"/>
49 <xsl:when test="$chunk != 0">
50 <cf:div class="{local-name(.)}" id="{generate-id()}">
51 <xsl:apply-templates select="*" mode="find.chunks"/>
55 <xsl:apply-templates select="*" mode="find.chunks"/>
60 <!-- ==================================================================== -->
62 <xsl:template name="process-chunk-element">
63 <xsl:param name="content">
68 <xsl:when test="$chunk.fast != 0 and function-available('exsl:node-set')">
69 <xsl:variable name="chunks" select="exsl:node-set($chunk.hierarchy)//cf:div"/>
70 <xsl:variable name="genid" select="generate-id()"/>
72 <xsl:variable name="div" select="$chunks[@id=$genid]"/>
74 <xsl:variable name="prevdiv" select="($div/preceding-sibling::cf:div|$div/preceding::cf:div|$div/parent::cf:div)[last()]"/>
75 <xsl:variable name="prev" select="key('genid', $prevdiv/@id)"/>
77 <xsl:variable name="nextdiv" select="($div/following-sibling::cf:div|$div/following::cf:div|$div/cf:div)[1]"/>
78 <xsl:variable name="next" select="key('genid', $nextdiv/@id)"/>
81 <xsl:when test="$onechunk != 0 and parent::*">
82 <xsl:copy-of select="$content"/>
85 <xsl:call-template name="process-chunk">
86 <xsl:with-param name="prev" select="$prev"/>
87 <xsl:with-param name="next" select="$next"/>
88 <xsl:with-param name="content" select="$content"/>
95 <xsl:when test="$onechunk != 0 and not(parent::*)">
96 <xsl:call-template name="chunk-all-sections">
97 <xsl:with-param name="content" select="$content"/>
100 <xsl:when test="$onechunk != 0">
101 <xsl:copy-of select="$content"/>
103 <xsl:when test="$chunk.first.sections = 0">
104 <xsl:call-template name="chunk-first-section-with-parent">
105 <xsl:with-param name="content" select="$content"/>
109 <xsl:call-template name="chunk-all-sections">
110 <xsl:with-param name="content" select="$content"/>
118 <xsl:template name="process-chunk">
119 <xsl:param name="prev" select="."/>
120 <xsl:param name="next" select="."/>
121 <xsl:param name="content">
125 <xsl:variable name="ischunk">
126 <xsl:call-template name="chunk"/>
129 <xsl:variable name="chunkfn">
130 <xsl:if test="$ischunk='1'">
131 <xsl:apply-templates mode="chunk-filename" select="."/>
135 <xsl:if test="$ischunk='0'">
137 <xsl:text>Error </xsl:text>
138 <xsl:value-of select="name(.)"/>
139 <xsl:text> is not a chunk!</xsl:text>
143 <xsl:variable name="filename">
144 <xsl:call-template name="make-relative-filename">
145 <xsl:with-param name="base.dir" select="$base.dir"/>
146 <xsl:with-param name="base.name" select="$chunkfn"/>
150 <xsl:call-template name="write.chunk">
151 <xsl:with-param name="filename" select="$filename"/>
152 <xsl:with-param name="content">
153 <xsl:call-template name="chunk-element-content">
154 <xsl:with-param name="prev" select="$prev"/>
155 <xsl:with-param name="next" select="$next"/>
156 <xsl:with-param name="content" select="$content"/>
159 <xsl:with-param name="quiet" select="$chunk.quietly"/>
163 <xsl:template name="chunk-first-section-with-parent">
164 <xsl:param name="content">
168 <!-- These xpath expressions are really hairy. The trick is to pick sections -->
169 <!-- that are not first children and are not the children of first children -->
171 <!-- Break these variables into pieces to work around
172 http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6063 -->
174 <xsl:variable name="prev-v1" select="(ancestor::sect1[$chunk.section.depth > 0 and preceding-sibling::sect1][1] |ancestor::sect2[$chunk.section.depth > 1 and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |ancestor::sect3[$chunk.section.depth > 2 and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |ancestor::sect4[$chunk.section.depth > 3 and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect2] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |ancestor::sect5[$chunk.section.depth > 4 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::section[not(preceding-sibling::section)])][1])[last()]"/>
176 <xsl:variable name="prev-v2" select="(preceding::sect1[$chunk.section.depth > 0 and preceding-sibling::sect1][1] |preceding::sect2[$chunk.section.depth > 1 and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |preceding::sect3[$chunk.section.depth > 2 and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |preceding::sect4[$chunk.section.depth > 3 and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect2] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |preceding::sect5[$chunk.section.depth > 4 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 preceding-sibling::section and not(ancestor::section[not(preceding-sibling::section)])][1])[last()]"/>
178 <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()]"/>
180 <xsl:variable name="next-v1" select="(following::sect1[$chunk.section.depth > 0 and preceding-sibling::sect1][1] |following::sect2[$chunk.section.depth > 1 and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |following::sect3[$chunk.section.depth > 2 and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |following::sect4[$chunk.section.depth > 3 and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect2] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |following::sect5[$chunk.section.depth > 4 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 preceding-sibling::section and not(ancestor::section[not(preceding-sibling::section)])][1])[1]"/>
182 <xsl:variable name="next-v2" select="(descendant::sect1[$chunk.section.depth > 0 and preceding-sibling::sect1][1] |descendant::sect2[$chunk.section.depth > 1 and preceding-sibling::sect2 and parent::sect1[preceding-sibling::sect1]][1] |descendant::sect3[$chunk.section.depth > 2 and preceding-sibling::sect3 and parent::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |descendant::sect4[$chunk.section.depth > 3 and preceding-sibling::sect4 and parent::sect3[preceding-sibling::sect2] and ancestor::sect2[preceding-sibling::sect2] and ancestor::sect1[preceding-sibling::sect1]][1] |descendant::sect5[$chunk.section.depth > 4 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 preceding-sibling::section and not(ancestor::section[not(preceding-sibling::section)])])[1]"/>
184 <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]"/>
186 <xsl:call-template name="process-chunk">
187 <xsl:with-param name="prev" select="$prev"/>
188 <xsl:with-param name="next" select="$next"/>
189 <xsl:with-param name="content" select="$content"/>
193 <xsl:template name="chunk-all-sections">
194 <xsl:param name="content">
198 <xsl:variable name="prev-v1" select="(preceding::sect1[$chunk.section.depth > 0][1] |preceding::sect2[$chunk.section.depth > 1][1] |preceding::sect3[$chunk.section.depth > 2][1] |preceding::sect4[$chunk.section.depth > 3][1] |preceding::sect5[$chunk.section.depth > 4][1] |preceding::section[$chunk.section.depth > count(ancestor::section)][1])[last()]"/>
200 <xsl:variable name="prev-v2" select="(ancestor::sect1[$chunk.section.depth > 0][1] |ancestor::sect2[$chunk.section.depth > 1][1] |ancestor::sect3[$chunk.section.depth > 2][1] |ancestor::sect4[$chunk.section.depth > 3][1] |ancestor::sect5[$chunk.section.depth > 4][1] |ancestor::section[$chunk.section.depth > count(ancestor::section)][1])[last()]"/>
202 <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()]"/>
204 <xsl:variable name="next-v1" select="(following::sect1[$chunk.section.depth > 0][1] |following::sect2[$chunk.section.depth > 1][1] |following::sect3[$chunk.section.depth > 2][1] |following::sect4[$chunk.section.depth > 3][1] |following::sect5[$chunk.section.depth > 4][1] |following::section[$chunk.section.depth > count(ancestor::section)][1])[1]"/>
206 <xsl:variable name="next-v2" select="(descendant::sect1[$chunk.section.depth > 0][1] |descendant::sect2[$chunk.section.depth > 1][1] |descendant::sect3[$chunk.section.depth > 2][1] |descendant::sect4[$chunk.section.depth > 3][1] |descendant::sect5[$chunk.section.depth > 4][1] |descendant::section[$chunk.section.depth > count(ancestor::section)][1])[1]"/>
208 <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]"/>
210 <xsl:call-template name="process-chunk">
211 <xsl:with-param name="prev" select="$prev"/>
212 <xsl:with-param name="next" select="$next"/>
213 <xsl:with-param name="content" select="$content"/>
217 <!-- ==================================================================== -->
219 <xsl:template match="/">
221 <xsl:when test="function-available('exsl:node-set') and (*/self::ng:* or */self::db:*)">
222 <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
223 toss the namespace and continue. Someday we'll reverse this logic
224 and add the namespace to documents that don't have one.
225 But not before the whole stylesheet has been converted to use
226 namespaces. i.e., don't hold your breath -->
227 <xsl:message>Stripping NS from DocBook 5/NG document.</xsl:message>
228 <xsl:variable name="nons">
229 <xsl:apply-templates mode="stripNS"/>
231 <xsl:message>Processing stripped document.</xsl:message>
232 <xsl:apply-templates select="exsl:node-set($nons)"/>
236 <xsl:when test="$rootid != ''">
238 <xsl:when test="count(key('id',$rootid)) = 0">
239 <xsl:message terminate="yes">
240 <xsl:text>ID '</xsl:text>
241 <xsl:value-of select="$rootid"/>
242 <xsl:text>' not found in document.</xsl:text>
246 <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
247 <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
249 <xsl:if test="$collect.xref.targets != 'only'">
250 <xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
251 <xsl:if test="$tex.math.in.alt != ''">
252 <xsl:apply-templates select="key('id',$rootid)" mode="collect.tex.math"/>
254 <xsl:if test="$generate.manifest != 0">
255 <xsl:call-template name="generate.manifest">
256 <xsl:with-param name="node" select="key('id',$rootid)"/>
264 <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
265 <xsl:apply-templates select="/" mode="collect.targets"/>
267 <xsl:if test="$collect.xref.targets != 'only'">
268 <xsl:apply-templates select="/" mode="process.root"/>
269 <xsl:if test="$tex.math.in.alt != ''">
270 <xsl:apply-templates select="/" mode="collect.tex.math"/>
272 <xsl:if test="$generate.manifest != 0">
273 <xsl:call-template name="generate.manifest">
274 <xsl:with-param name="node" select="/"/>
284 <xsl:template match="*" mode="process.root">
285 <xsl:apply-templates select="."/>
288 <!-- ====================================================================== -->
290 <xsl:template match="set|book|part|preface|chapter|appendix |article |reference|refentry |book/glossary|article/glossary|part/glossary |book/bibliography|article/bibliography|part/bibliography |colophon">
292 <xsl:when test="$onechunk != 0 and parent::*">
296 <xsl:call-template name="process-chunk-element"/>
301 <xsl:template match="sect1|sect2|sect3|sect4|sect5|section">
302 <xsl:variable name="ischunk">
303 <xsl:call-template name="chunk"/>
307 <xsl:when test="not(parent::*)">
308 <xsl:call-template name="process-chunk-element"/>
310 <xsl:when test="$ischunk = 0">
314 <xsl:call-template name="process-chunk-element"/>
319 <xsl:template match="setindex |book/index |article/index |part/index">
320 <!-- some implementations use completely empty index tags to indicate -->
321 <!-- where an automatically generated index should be inserted. so -->
322 <!-- if the index is completely empty, skip it. -->
323 <xsl:if test="count(*)>0 or $generate.index != '0'">
324 <xsl:call-template name="process-chunk-element"/>
328 <!-- ==================================================================== -->
330 <xsl:template name="make.lots">
331 <xsl:param name="toc.params" select="''"/>
332 <xsl:param name="toc"/>
334 <xsl:variable name="lots">
335 <xsl:if test="contains($toc.params, 'toc')">
336 <xsl:copy-of select="$toc"/>
339 <xsl:if test="contains($toc.params, 'figure')">
341 <xsl:when test="$chunk.separate.lots != '0'">
342 <xsl:call-template name="make.lot.chunk">
343 <xsl:with-param name="type" select="'figure'"/>
344 <xsl:with-param name="lot">
345 <xsl:call-template name="list.of.titles">
346 <xsl:with-param name="titles" select="'figure'"/>
347 <xsl:with-param name="nodes" select=".//figure"/>
353 <xsl:call-template name="list.of.titles">
354 <xsl:with-param name="titles" select="'figure'"/>
355 <xsl:with-param name="nodes" select=".//figure"/>
361 <xsl:if test="contains($toc.params, 'table')">
363 <xsl:when test="$chunk.separate.lots != '0'">
364 <xsl:call-template name="make.lot.chunk">
365 <xsl:with-param name="type" select="'table'"/>
366 <xsl:with-param name="lot">
367 <xsl:call-template name="list.of.titles">
368 <xsl:with-param name="titles" select="'table'"/>
369 <xsl:with-param name="nodes" select=".//table"/>
375 <xsl:call-template name="list.of.titles">
376 <xsl:with-param name="titles" select="'table'"/>
377 <xsl:with-param name="nodes" select=".//table"/>
383 <xsl:if test="contains($toc.params, 'example')">
385 <xsl:when test="$chunk.separate.lots != '0'">
386 <xsl:call-template name="make.lot.chunk">
387 <xsl:with-param name="type" select="'example'"/>
388 <xsl:with-param name="lot">
389 <xsl:call-template name="list.of.titles">
390 <xsl:with-param name="titles" select="'example'"/>
391 <xsl:with-param name="nodes" select=".//example"/>
397 <xsl:call-template name="list.of.titles">
398 <xsl:with-param name="titles" select="'example'"/>
399 <xsl:with-param name="nodes" select=".//example"/>
405 <xsl:if test="contains($toc.params, 'equation')">
407 <xsl:when test="$chunk.separate.lots != '0'">
408 <xsl:call-template name="make.lot.chunk">
409 <xsl:with-param name="type" select="'equation'"/>
410 <xsl:with-param name="lot">
411 <xsl:call-template name="list.of.titles">
412 <xsl:with-param name="titles" select="'equation'"/>
413 <xsl:with-param name="nodes" select=".//equation"/>
419 <xsl:call-template name="list.of.titles">
420 <xsl:with-param name="titles" select="'equation'"/>
421 <xsl:with-param name="nodes" select=".//equation"/>
427 <xsl:if test="contains($toc.params, 'procedure')">
429 <xsl:when test="$chunk.separate.lots != '0'">
430 <xsl:call-template name="make.lot.chunk">
431 <xsl:with-param name="type" select="'procedure'"/>
432 <xsl:with-param name="lot">
433 <xsl:call-template name="list.of.titles">
434 <xsl:with-param name="titles" select="'procedure'"/>
435 <xsl:with-param name="nodes" select=".//procedure[title]"/>
441 <xsl:call-template name="list.of.titles">
442 <xsl:with-param name="titles" select="'procedure'"/>
443 <xsl:with-param name="nodes" select=".//procedure[title]"/>
450 <xsl:if test="string($lots) != ''">
452 <xsl:when test="$chunk.tocs.and.lots != 0 and not(parent::*)">
453 <xsl:call-template name="write.chunk">
454 <xsl:with-param name="filename">
455 <xsl:call-template name="make-relative-filename">
456 <xsl:with-param name="base.dir" select="$base.dir"/>
457 <xsl:with-param name="base.name">
458 <xsl:call-template name="dbhtml-dir"/>
459 <xsl:apply-templates select="." mode="recursive-chunk-filename">
460 <xsl:with-param name="recursive" select="true()"/>
461 </xsl:apply-templates>
462 <xsl:text>-toc</xsl:text>
463 <xsl:value-of select="$html.ext"/>
467 <xsl:with-param name="content">
468 <xsl:call-template name="chunk-element-content">
469 <xsl:with-param name="prev" select="/foo"/>
470 <xsl:with-param name="next" select="/foo"/>
471 <xsl:with-param name="nav.context" select="'toc'"/>
472 <xsl:with-param name="content">
474 <xsl:apply-templates select="." mode="object.title.markup"/>
476 <xsl:copy-of select="$lots"/>
480 <xsl:with-param name="quiet" select="$chunk.quietly"/>
484 <xsl:copy-of select="$lots"/>
490 <xsl:template name="make.lot.chunk">
491 <xsl:param name="type" select="''"/>
492 <xsl:param name="lot"/>
494 <xsl:if test="string($lot) != ''">
495 <xsl:variable name="filename">
496 <xsl:call-template name="make-relative-filename">
497 <xsl:with-param name="base.dir" select="$base.dir"/>
498 <xsl:with-param name="base.name">
499 <xsl:call-template name="dbhtml-dir"/>
500 <xsl:value-of select="$type"/>
501 <xsl:text>-toc</xsl:text>
502 <xsl:value-of select="$html.ext"/>
507 <xsl:variable name="href">
508 <xsl:call-template name="make-relative-filename">
509 <xsl:with-param name="base.name">
510 <xsl:call-template name="dbhtml-dir"/>
511 <xsl:value-of select="$type"/>
512 <xsl:text>-toc</xsl:text>
513 <xsl:value-of select="$html.ext"/>
518 <xsl:call-template name="write.chunk">
519 <xsl:with-param name="filename" select="$filename"/>
520 <xsl:with-param name="content">
521 <xsl:call-template name="chunk-element-content">
522 <xsl:with-param name="prev" select="/foo"/>
523 <xsl:with-param name="next" select="/foo"/>
524 <xsl:with-param name="nav.context" select="'toc'"/>
525 <xsl:with-param name="content">
526 <xsl:copy-of select="$lot"/>
530 <xsl:with-param name="quiet" select="$chunk.quietly"/>
532 <!-- And output a link to this file -->
534 <xsl:attribute name="class">
535 <xsl:text>ListofTitles</xsl:text>
538 <xsl:call-template name="gentext">
539 <xsl:with-param name="key">
541 <xsl:when test="$type='table'">ListofTables</xsl:when>
542 <xsl:when test="$type='figure'">ListofFigures</xsl:when>
543 <xsl:when test="$type='equation'">ListofEquations</xsl:when>
544 <xsl:when test="$type='example'">ListofExamples</xsl:when>
545 <xsl:when test="$type='procedure'">ListofProcedures</xsl:when>
546 <xsl:otherwise>ListofUnknown</xsl:otherwise>
555 <!-- ==================================================================== -->
557 <xsl:template name="in.other.chunk">
558 <xsl:param name="chunk" select="."/>
559 <xsl:param name="node" select="."/>
561 <xsl:variable name="is.chunk">
562 <xsl:call-template name="chunk">
563 <xsl:with-param name="node" select="$node"/>
569 <xsl:text>in.other.chunk: </xsl:text>
570 <xsl:value-of select="name($chunk)"/>
571 <xsl:text> </xsl:text>
572 <xsl:value-of select="name($node)"/>
573 <xsl:text> </xsl:text>
574 <xsl:value-of select="$chunk = $node"/>
575 <xsl:text> </xsl:text>
576 <xsl:value-of select="$is.chunk"/>
581 <xsl:when test="$chunk = $node">0</xsl:when>
582 <xsl:when test="$is.chunk = 1">1</xsl:when>
583 <xsl:when test="count($node) = 0">0</xsl:when>
585 <xsl:call-template name="in.other.chunk">
586 <xsl:with-param name="chunk" select="$chunk"/>
587 <xsl:with-param name="node" select="$node/parent::*"/>
593 <xsl:template name="count.footnotes.in.this.chunk">
594 <xsl:param name="node" select="."/>
595 <xsl:param name="footnotes" select="$node//footnote"/>
596 <xsl:param name="count" select="0"/>
600 <xsl:text>count.footnotes.in.this.chunk: </xsl:text>
601 <xsl:value-of select="name($node)"/>
605 <xsl:variable name="in.other.chunk">
606 <xsl:call-template name="in.other.chunk">
607 <xsl:with-param name="chunk" select="$node"/>
608 <xsl:with-param name="node" select="$footnotes[1]"/>
613 <xsl:when test="count($footnotes) = 0">
614 <xsl:value-of select="$count"/>
618 <xsl:when test="$in.other.chunk != 0">
619 <xsl:call-template name="count.footnotes.in.this.chunk">
620 <xsl:with-param name="node" select="$node"/>
621 <xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
622 <xsl:with-param name="count" select="$count"/>
625 <xsl:when test="$footnotes[1]/ancestor::table |$footnotes[1]/ancestor::informaltable">
626 <xsl:call-template name="count.footnotes.in.this.chunk">
627 <xsl:with-param name="node" select="$node"/>
628 <xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
629 <xsl:with-param name="count" select="$count"/>
633 <xsl:call-template name="count.footnotes.in.this.chunk">
634 <xsl:with-param name="node" select="$node"/>
635 <xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
636 <xsl:with-param name="count" select="$count + 1"/>
644 <xsl:template name="process.footnotes.in.this.chunk">
645 <xsl:param name="node" select="."/>
646 <xsl:param name="footnotes" select="$node//footnote"/>
649 <xsl:message>process.footnotes.in.this.chunk</xsl:message>
652 <xsl:variable name="in.other.chunk">
653 <xsl:call-template name="in.other.chunk">
654 <xsl:with-param name="chunk" select="$node"/>
655 <xsl:with-param name="node" select="$footnotes[1]"/>
660 <xsl:when test="count($footnotes) = 0">
665 <xsl:when test="$in.other.chunk != 0">
666 <xsl:call-template name="process.footnotes.in.this.chunk">
667 <xsl:with-param name="node" select="$node"/>
668 <xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
671 <xsl:when test="$footnotes[1]/ancestor::table |$footnotes[1]/ancestor::informaltable">
672 <xsl:call-template name="process.footnotes.in.this.chunk">
673 <xsl:with-param name="node" select="$node"/>
674 <xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
678 <xsl:apply-templates select="$footnotes[1]" mode="process.footnote.mode"/>
679 <xsl:call-template name="process.footnotes.in.this.chunk">
680 <xsl:with-param name="node" select="$node"/>
681 <xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
689 <xsl:template name="process.footnotes">
690 <xsl:variable name="footnotes" select=".//footnote"/>
691 <xsl:variable name="fcount">
692 <xsl:call-template name="count.footnotes.in.this.chunk">
693 <xsl:with-param name="node" select="."/>
694 <xsl:with-param name="footnotes" select="$footnotes"/>
700 <xsl:value-of select="name(.)"/>
701 <xsl:text> fcount: </xsl:text>
702 <xsl:value-of select="$fcount"/>
706 <!-- Only bother to do this if there's at least one non-table footnote -->
707 <xsl:if test="$fcount > 0">
708 <div class="footnotes">
710 <hr width="100" align="left"/>
711 <xsl:call-template name="process.footnotes.in.this.chunk">
712 <xsl:with-param name="node" select="."/>
713 <xsl:with-param name="footnotes" select="$footnotes"/>
718 <!-- FIXME: When chunking, only the annotations actually used
719 in this chunk should be referenced. I don't think it
720 does any harm to reference them all, but it adds
721 unnecessary bloat to each chunk. -->
722 <xsl:if test="$annotation.support != 0 and //annotation">
723 <div class="annotation-list">
724 <div class="annotation-nocss">
725 <p>The following annotations are from this essay. You are seeing
726 them here because your browser doesn’t support the user-interface
727 techniques used to make them appear as ‘popups’ on modern browsers.</p>
730 <xsl:apply-templates select="//annotation" mode="annotation-popup"/>
735 <xsl:template name="process.chunk.footnotes">
736 <xsl:variable name="is.chunk">
737 <xsl:call-template name="chunk"/>
739 <xsl:if test="$is.chunk = 1">
740 <xsl:call-template name="process.footnotes"/>
744 <!-- ====================================================================== -->
746 <!-- Resolve xml:base attributes -->
747 <xsl:template match="@fileref">
748 <!-- need a check for absolute urls -->
750 <xsl:when test="contains(., ':')">
751 <!-- it has a uri scheme so it is an absolute uri -->
752 <xsl:value-of select="."/>
755 <!-- its a relative uri -->
756 <xsl:call-template name="relative-uri">
757 <xsl:with-param name="destdir">
758 <xsl:call-template name="dbhtml-dir">
759 <xsl:with-param name="context" select=".."/>