1
<?xml version="1.0" encoding="US-ASCII"?>
2
<!--This file was created automatically by xsl2profile-->
3
<!--from the DocBook XSL 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:exslt="http://exslt.org/common" exslt:dummy="dummy" extension-element-prefixes="exslt" version="1.0" exclude-result-prefixes="exsl exslt">
6
<!-- ********************************************************************
7
$Id: profile-chunk-code.xsl 922431 2009-02-07 01:12:28Z schwarzer $
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
<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)//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::div|$div/preceding::div|$div/parent::div)[last()]"/>
75
<xsl:variable name="prev" select="key('genid', $prevdiv/@id)"/>
77
<xsl:variable name="nextdiv" select="($div/following-sibling::div|$div/following::div|$div/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
<xslo:include xmlns:xslo="http://www.w3.org/1999/XSL/Transform" href="../profiling/profile-mode.xsl"/><xsl:template match="/"><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-content"><xslo:apply-templates select="." mode="profile"/></xslo:variable><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-nodes" select="exslt:node-set($profiled-content)"/>
221
<xsl:when test="$rootid != ''">
223
<xsl:when test="count($profiled-nodes//*[@id=$rootid]) = 0">
224
<xsl:message terminate="yes">
225
<xsl:text>ID '</xsl:text>
226
<xsl:value-of select="$rootid"/>
227
<xsl:text>' not found in document.</xsl:text>
231
<xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
232
<xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
234
<xsl:if test="$collect.xref.targets != 'only'">
235
<xsl:apply-templates select="$profiled-nodes//*[@id=$rootid]" mode="process.root"/>
236
<xsl:if test="$tex.math.in.alt != ''">
237
<xsl:apply-templates select="$profiled-nodes//*[@id=$rootid]" mode="collect.tex.math"/>
239
<xsl:if test="$generate.manifest != 0">
240
<xsl:call-template name="generate.manifest">
241
<xsl:with-param name="node" select="key('id',$rootid)"/>
249
<xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'">
250
<xsl:apply-templates select="$profiled-nodes" mode="collect.targets"/>
252
<xsl:if test="$collect.xref.targets != 'only'">
253
<xsl:apply-templates select="$profiled-nodes" mode="process.root"/>
254
<xsl:if test="$tex.math.in.alt != ''">
255
<xsl:apply-templates select="$profiled-nodes" mode="collect.tex.math"/>
257
<xsl:if test="$generate.manifest != 0">
258
<xsl:call-template name="generate.manifest"/>
265
<xsl:template match="*" mode="process.root">
266
<xsl:apply-templates select="."/>
269
<!-- ====================================================================== -->
271
<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">
273
<xsl:when test="$onechunk != 0 and parent::*">
277
<xsl:call-template name="process-chunk-element"/>
282
<xsl:template match="sect1|sect2|sect3|sect4|sect5|section">
283
<xsl:variable name="ischunk">
284
<xsl:call-template name="chunk"/>
288
<xsl:when test="not(parent::*)">
289
<xsl:call-template name="process-chunk-element"/>
291
<xsl:when test="$ischunk = 0">
295
<xsl:call-template name="process-chunk-element"/>
300
<xsl:template match="setindex |book/index |article/index |part/index">
301
<!-- some implementations use completely empty index tags to indicate -->
302
<!-- where an automatically generated index should be inserted. so -->
303
<!-- if the index is completely empty, skip it. -->
304
<xsl:if test="count(*)>0 or $generate.index != '0'">
305
<xsl:call-template name="process-chunk-element"/>
309
<!-- ==================================================================== -->
311
<xsl:template name="make.lots">
312
<xsl:param name="toc.params" select="''"/>
313
<xsl:param name="toc"/>
315
<xsl:variable name="lots">
316
<xsl:if test="contains($toc.params, 'toc')">
317
<xsl:copy-of select="$toc"/>
320
<xsl:if test="contains($toc.params, 'figure')">
322
<xsl:when test="$chunk.separate.lots != '0'">
323
<xsl:call-template name="make.lot.chunk">
324
<xsl:with-param name="type" select="'figure'"/>
325
<xsl:with-param name="lot">
326
<xsl:call-template name="list.of.titles">
327
<xsl:with-param name="titles" select="'figure'"/>
328
<xsl:with-param name="nodes" select=".//figure"/>
334
<xsl:call-template name="list.of.titles">
335
<xsl:with-param name="titles" select="'figure'"/>
336
<xsl:with-param name="nodes" select=".//figure"/>
342
<xsl:if test="contains($toc.params, 'table')">
344
<xsl:when test="$chunk.separate.lots != '0'">
345
<xsl:call-template name="make.lot.chunk">
346
<xsl:with-param name="type" select="'table'"/>
347
<xsl:with-param name="lot">
348
<xsl:call-template name="list.of.titles">
349
<xsl:with-param name="titles" select="'table'"/>
350
<xsl:with-param name="nodes" select=".//table"/>
356
<xsl:call-template name="list.of.titles">
357
<xsl:with-param name="titles" select="'table'"/>
358
<xsl:with-param name="nodes" select=".//table"/>
364
<xsl:if test="contains($toc.params, 'example')">
366
<xsl:when test="$chunk.separate.lots != '0'">
367
<xsl:call-template name="make.lot.chunk">
368
<xsl:with-param name="type" select="'example'"/>
369
<xsl:with-param name="lot">
370
<xsl:call-template name="list.of.titles">
371
<xsl:with-param name="titles" select="'example'"/>
372
<xsl:with-param name="nodes" select=".//example"/>
378
<xsl:call-template name="list.of.titles">
379
<xsl:with-param name="titles" select="'example'"/>
380
<xsl:with-param name="nodes" select=".//example"/>
386
<xsl:if test="contains($toc.params, 'equation')">
388
<xsl:when test="$chunk.separate.lots != '0'">
389
<xsl:call-template name="make.lot.chunk">
390
<xsl:with-param name="type" select="'equation'"/>
391
<xsl:with-param name="lot">
392
<xsl:call-template name="list.of.titles">
393
<xsl:with-param name="titles" select="'equation'"/>
394
<xsl:with-param name="nodes" select=".//equation"/>
400
<xsl:call-template name="list.of.titles">
401
<xsl:with-param name="titles" select="'equation'"/>
402
<xsl:with-param name="nodes" select=".//equation"/>
408
<xsl:if test="contains($toc.params, 'procedure')">
410
<xsl:when test="$chunk.separate.lots != '0'">
411
<xsl:call-template name="make.lot.chunk">
412
<xsl:with-param name="type" select="'procedure'"/>
413
<xsl:with-param name="lot">
414
<xsl:call-template name="list.of.titles">
415
<xsl:with-param name="titles" select="'procedure'"/>
416
<xsl:with-param name="nodes" select=".//procedure[title]"/>
422
<xsl:call-template name="list.of.titles">
423
<xsl:with-param name="titles" select="'procedure'"/>
424
<xsl:with-param name="nodes" select=".//procedure[title]"/>
431
<xsl:if test="string($lots) != ''">
433
<xsl:when test="$chunk.tocs.and.lots != 0 and not(parent::*)">
434
<xsl:call-template name="write.chunk">
435
<xsl:with-param name="filename">
436
<xsl:call-template name="make-relative-filename">
437
<xsl:with-param name="base.dir" select="$base.dir"/>
438
<xsl:with-param name="base.name">
439
<xsl:call-template name="dbhtml-dir"/>
440
<xsl:apply-templates select="." mode="recursive-chunk-filename">
441
<xsl:with-param name="recursive" select="true()"/>
442
</xsl:apply-templates>
443
<xsl:text>-toc</xsl:text>
444
<xsl:value-of select="$html.ext"/>
448
<xsl:with-param name="content">
449
<xsl:call-template name="chunk-element-content">
450
<xsl:with-param name="prev" select="/foo"/>
451
<xsl:with-param name="next" select="/foo"/>
452
<xsl:with-param name="nav.context" select="'toc'"/>
453
<xsl:with-param name="content">
455
<xsl:apply-templates select="." mode="object.title.markup"/>
457
<xsl:copy-of select="$lots"/>
461
<xsl:with-param name="quiet" select="$chunk.quietly"/>
465
<xsl:copy-of select="$lots"/>
471
<xsl:template name="make.lot.chunk">
472
<xsl:param name="type" select="''"/>
473
<xsl:param name="lot"/>
475
<xsl:if test="string($lot) != ''">
476
<xsl:variable name="filename">
477
<xsl:call-template name="make-relative-filename">
478
<xsl:with-param name="base.dir" select="$base.dir"/>
479
<xsl:with-param name="base.name">
480
<xsl:call-template name="dbhtml-dir"/>
481
<xsl:value-of select="$type"/>
482
<xsl:text>-toc</xsl:text>
483
<xsl:value-of select="$html.ext"/>
488
<xsl:variable name="href">
489
<xsl:call-template name="make-relative-filename">
490
<xsl:with-param name="base.name">
491
<xsl:call-template name="dbhtml-dir"/>
492
<xsl:value-of select="$type"/>
493
<xsl:text>-toc</xsl:text>
494
<xsl:value-of select="$html.ext"/>
499
<xsl:call-template name="write.chunk">
500
<xsl:with-param name="filename" select="$filename"/>
501
<xsl:with-param name="content">
502
<xsl:call-template name="chunk-element-content">
503
<xsl:with-param name="prev" select="/foo"/>
504
<xsl:with-param name="next" select="/foo"/>
505
<xsl:with-param name="nav.context" select="'toc'"/>
506
<xsl:with-param name="content">
507
<xsl:copy-of select="$lot"/>
511
<xsl:with-param name="quiet" select="$chunk.quietly"/>
513
<!-- And output a link to this file -->
515
<xsl:attribute name="class">
516
<xsl:text>ListofTitles</xsl:text>
519
<xsl:call-template name="gentext">
520
<xsl:with-param name="key">
522
<xsl:when test="$type='table'">ListofTables</xsl:when>
523
<xsl:when test="$type='figure'">ListofFigures</xsl:when>
524
<xsl:when test="$type='equation'">ListofEquations</xsl:when>
525
<xsl:when test="$type='example'">ListofExamples</xsl:when>
526
<xsl:when test="$type='procedure'">ListofProcedures</xsl:when>
527
<xsl:otherwise>ListofUnknown</xsl:otherwise>
536
<!-- ==================================================================== -->
538
<xsl:template name="in.other.chunk">
539
<xsl:param name="chunk" select="."/>
540
<xsl:param name="node" select="."/>
542
<xsl:variable name="is.chunk">
543
<xsl:call-template name="chunk">
544
<xsl:with-param name="node" select="$node"/>
550
<xsl:text>in.other.chunk: </xsl:text>
551
<xsl:value-of select="name($chunk)"/>
552
<xsl:text> </xsl:text>
553
<xsl:value-of select="name($node)"/>
554
<xsl:text> </xsl:text>
555
<xsl:value-of select="$chunk = $node"/>
556
<xsl:text> </xsl:text>
557
<xsl:value-of select="$is.chunk"/>
562
<xsl:when test="$chunk = $node">0</xsl:when>
563
<xsl:when test="$is.chunk = 1">1</xsl:when>
564
<xsl:when test="count($node) = 0">0</xsl:when>
566
<xsl:call-template name="in.other.chunk">
567
<xsl:with-param name="chunk" select="$chunk"/>
568
<xsl:with-param name="node" select="$node/parent::*"/>
574
<xsl:template name="count.footnotes.in.this.chunk">
575
<xsl:param name="node" select="."/>
576
<xsl:param name="footnotes" select="$node//footnote"/>
577
<xsl:param name="count" select="0"/>
581
<xsl:text>count.footnotes.in.this.chunk: </xsl:text>
582
<xsl:value-of select="name($node)"/>
586
<xsl:variable name="in.other.chunk">
587
<xsl:call-template name="in.other.chunk">
588
<xsl:with-param name="chunk" select="$node"/>
589
<xsl:with-param name="node" select="$footnotes[1]"/>
594
<xsl:when test="count($footnotes) = 0">
595
<xsl:value-of select="$count"/>
599
<xsl:when test="$in.other.chunk != 0">
600
<xsl:call-template name="count.footnotes.in.this.chunk">
601
<xsl:with-param name="node" select="$node"/>
602
<xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
603
<xsl:with-param name="count" select="$count"/>
606
<xsl:when test="$footnotes[1]/ancestor::table |$footnotes[1]/ancestor::informaltable">
607
<xsl:call-template name="count.footnotes.in.this.chunk">
608
<xsl:with-param name="node" select="$node"/>
609
<xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
610
<xsl:with-param name="count" select="$count"/>
614
<xsl:call-template name="count.footnotes.in.this.chunk">
615
<xsl:with-param name="node" select="$node"/>
616
<xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
617
<xsl:with-param name="count" select="$count + 1"/>
625
<xsl:template name="process.footnotes.in.this.chunk">
626
<xsl:param name="node" select="."/>
627
<xsl:param name="footnotes" select="$node//footnote"/>
630
<xsl:message>process.footnotes.in.this.chunk</xsl:message>
633
<xsl:variable name="in.other.chunk">
634
<xsl:call-template name="in.other.chunk">
635
<xsl:with-param name="chunk" select="$node"/>
636
<xsl:with-param name="node" select="$footnotes[1]"/>
641
<xsl:when test="count($footnotes) = 0">
646
<xsl:when test="$in.other.chunk != 0">
647
<xsl:call-template name="process.footnotes.in.this.chunk">
648
<xsl:with-param name="node" select="$node"/>
649
<xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
652
<xsl:when test="$footnotes[1]/ancestor::table |$footnotes[1]/ancestor::informaltable">
653
<xsl:call-template name="process.footnotes.in.this.chunk">
654
<xsl:with-param name="node" select="$node"/>
655
<xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
659
<xsl:apply-templates select="$footnotes[1]" mode="process.footnote.mode"/>
660
<xsl:call-template name="process.footnotes.in.this.chunk">
661
<xsl:with-param name="node" select="$node"/>
662
<xsl:with-param name="footnotes" select="$footnotes[position() > 1]"/>
670
<xsl:template name="process.footnotes">
671
<xsl:variable name="footnotes" select=".//footnote"/>
672
<xsl:variable name="fcount">
673
<xsl:call-template name="count.footnotes.in.this.chunk">
674
<xsl:with-param name="node" select="."/>
675
<xsl:with-param name="footnotes" select="$footnotes"/>
681
<xsl:value-of select="name(.)"/>
682
<xsl:text> fcount: </xsl:text>
683
<xsl:value-of select="$fcount"/>
687
<!-- Only bother to do this if there's at least one non-table footnote -->
688
<xsl:if test="$fcount > 0">
689
<div class="footnotes">
691
<hr width="100" align="left"/>
692
<xsl:call-template name="process.footnotes.in.this.chunk">
693
<xsl:with-param name="node" select="."/>
694
<xsl:with-param name="footnotes" select="$footnotes"/>
700
<xsl:template name="process.chunk.footnotes">
701
<xsl:variable name="is.chunk">
702
<xsl:call-template name="chunk"/>
704
<xsl:if test="$is.chunk = 1">
705
<xsl:call-template name="process.footnotes"/>
709
<!-- ====================================================================== -->
711
<!-- Resolve xml:base attributes -->
712
<xsl:template match="@fileref">
713
<!-- need a check for absolute urls -->
715
<xsl:when test="contains(., ':')">
716
<!-- it has a uri scheme so it is an absolute uri -->
717
<xsl:value-of select="."/>
720
<!-- it is a relative uri -->
721
<xsl:call-template name="relative-uri">
722
<xsl:with-param name="destdir">
723
<xsl:call-template name="dbhtml-dir">
724
<xsl:with-param name="context" select=".."/>