2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:fo="http://www.w3.org/1999/XSL/Format"
4 xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions"
7 <!-- ********************************************************************
8 $Id: autotoc.xsl 9293 2012-04-19 18:42:11Z bobstayton $
9 ********************************************************************
11 This file is part of the XSL DocBook Stylesheet distribution.
12 See ../README or http://docbook.sf.net/release/xsl/current/ for
13 copyright and other information.
15 ******************************************************************** -->
17 <!-- ==================================================================== -->
19 <xsl:template name="set.toc">
21 <xsl:param name="toc-context" select="."/>
23 <xsl:variable name="id">
24 <xsl:call-template name="object.id"/>
27 <xsl:variable name="cid">
28 <xsl:call-template name="object.id">
29 <xsl:with-param name="object" select="$toc-context"/>
33 <xsl:variable name="nodes" select="book|set|setindex"/>
35 <xsl:if test="$nodes">
36 <fo:block id="toc...{$id}"
37 xsl:use-attribute-sets="toc.margin.properties">
38 <xsl:if test="$axf.extensions != 0">
39 <xsl:attribute name="axf:outline-level">1</xsl:attribute>
40 <xsl:attribute name="axf:outline-expand">false</xsl:attribute>
41 <xsl:attribute name="axf:outline-title">
42 <xsl:call-template name="gentext">
43 <xsl:with-param name="key" select="'TableofContents'"/>
47 <xsl:call-template name="table.of.contents.titlepage"/>
48 <xsl:apply-templates select="$nodes" mode="toc">
49 <xsl:with-param name="toc-context" select="$toc-context"/>
50 </xsl:apply-templates>
55 <xsl:template name="division.toc">
56 <xsl:param name="toc-context" select="."/>
57 <xsl:param name="toc.title.p" select="true()"/>
59 <xsl:variable name="cid">
60 <xsl:call-template name="object.id">
61 <xsl:with-param name="object" select="$toc-context"/>
65 <xsl:variable name="nodes"
66 select="$toc-context/part
67 |$toc-context/reference
70 |$toc-context/appendix
73 |$toc-context/bibliography
74 |$toc-context/glossary
75 |$toc-context/index"/>
77 <xsl:if test="$nodes">
78 <fo:block id="toc...{$cid}"
79 xsl:use-attribute-sets="toc.margin.properties">
80 <xsl:if test="$axf.extensions != 0">
81 <xsl:attribute name="axf:outline-level">1</xsl:attribute>
82 <xsl:attribute name="axf:outline-expand">false</xsl:attribute>
83 <xsl:attribute name="axf:outline-title">
84 <xsl:call-template name="gentext">
85 <xsl:with-param name="key" select="'TableofContents'"/>
89 <xsl:if test="$toc.title.p">
90 <xsl:call-template name="table.of.contents.titlepage"/>
92 <xsl:apply-templates select="$nodes" mode="toc">
93 <xsl:with-param name="toc-context" select="$toc-context"/>
94 </xsl:apply-templates>
99 <xsl:template name="component.toc">
100 <xsl:param name="toc-context" select="."/>
101 <xsl:param name="toc.title.p" select="true()"/>
103 <xsl:variable name="id">
104 <xsl:call-template name="object.id"/>
107 <xsl:variable name="cid">
108 <xsl:call-template name="object.id">
109 <xsl:with-param name="object" select="$toc-context"/>
113 <xsl:variable name="nodes" select="section|sect1|refentry
114 |article|topic|bibliography|glossary
115 |qandaset[$qanda.in.toc != 0]
117 <xsl:if test="$nodes">
118 <fo:block id="toc...{$id}"
119 xsl:use-attribute-sets="toc.margin.properties">
120 <xsl:if test="$toc.title.p">
121 <xsl:call-template name="table.of.contents.titlepage"/>
123 <xsl:apply-templates select="$nodes" mode="toc">
124 <xsl:with-param name="toc-context" select="$toc-context"/>
125 </xsl:apply-templates>
130 <xsl:template name="component.toc.separator">
131 <!-- Customize to output something between
132 component.toc and first output -->
135 <xsl:template name="section.toc">
136 <xsl:param name="toc-context" select="."/>
137 <xsl:param name="toc.title.p" select="true()"/>
139 <xsl:variable name="id">
140 <xsl:call-template name="object.id"/>
143 <xsl:variable name="cid">
144 <xsl:call-template name="object.id">
145 <xsl:with-param name="object" select="$toc-context"/>
149 <xsl:variable name="nodes"
150 select="section|sect1|sect2|sect3|sect4|sect5|refentry
151 |qandaset[$qanda.in.toc != 0]
152 |bridgehead[$bridgehead.in.toc != 0]"/>
154 <xsl:variable name="level">
155 <xsl:call-template name="section.level"/>
158 <xsl:if test="$nodes">
159 <fo:block id="toc...{$id}"
160 xsl:use-attribute-sets="toc.margin.properties">
162 <xsl:if test="$toc.title.p">
163 <xsl:call-template name="section.heading">
164 <xsl:with-param name="level" select="$level + 1"/>
165 <xsl:with-param name="title">
166 <fo:block space-after="0.5em">
167 <xsl:call-template name="gentext">
168 <xsl:with-param name="key" select="'TableofContents'"/>
175 <xsl:apply-templates select="$nodes" mode="toc">
176 <xsl:with-param name="toc-context" select="$toc-context"/>
177 </xsl:apply-templates>
182 <xsl:template name="section.toc.separator">
183 <!-- Customize to output something between
184 section.toc and first output -->
186 <!-- ==================================================================== -->
188 <xsl:template name="toc.line">
189 <xsl:param name="toc-context" select="NOTANODE"/>
191 <xsl:variable name="id">
192 <xsl:call-template name="object.id"/>
195 <xsl:variable name="label">
196 <xsl:apply-templates select="." mode="label.markup"/>
199 <fo:block xsl:use-attribute-sets="toc.line.properties">
200 <fo:inline keep-with-next.within-line="always">
201 <fo:basic-link internal-destination="{$id}">
202 <xsl:if test="$label != ''">
203 <xsl:copy-of select="$label"/>
204 <xsl:value-of select="$autotoc.label.separator"/>
206 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
209 <fo:inline keep-together.within-line="always">
210 <xsl:text> </xsl:text>
211 <fo:leader leader-pattern="dots"
212 leader-pattern-width="3pt"
213 leader-alignment="reference-area"
214 keep-with-next.within-line="always"/>
215 <xsl:text> </xsl:text>
216 <fo:basic-link internal-destination="{$id}">
217 <fo:page-number-citation ref-id="{$id}"/>
223 <!-- ==================================================================== -->
224 <xsl:template name="qandaset.toc">
225 <xsl:param name="toc-context" select="."/>
226 <xsl:param name="toc.title.p" select="true()"/>
228 <xsl:variable name="id">
229 <xsl:call-template name="object.id"/>
232 <xsl:variable name="cid">
233 <xsl:call-template name="object.id">
234 <xsl:with-param name="object" select="$toc-context"/>
238 <xsl:variable name="nodes" select="qandadiv|qandaentry"/>
240 <xsl:if test="$nodes">
241 <fo:block id="toc...{$id}"
242 xsl:use-attribute-sets="toc.margin.properties">
243 <xsl:if test="$toc.title.p">
244 <xsl:call-template name="table.of.contents.titlepage"/>
246 <xsl:apply-templates select="$nodes" mode="toc">
247 <xsl:with-param name="toc-context" select="$toc-context"/>
248 </xsl:apply-templates>
253 <xsl:template name="qandaset.toc.separator">
254 <!-- Customize to output something between
255 qandaset.toc and first output -->
258 <xsl:template match="qandadiv" mode="toc">
259 <xsl:param name="toc-context" select="."/>
261 <xsl:variable name="id">
262 <xsl:call-template name="object.id"/>
265 <xsl:variable name="cid">
266 <xsl:call-template name="object.id">
267 <xsl:with-param name="object" select="$toc-context"/>
271 <xsl:call-template name="toc.line">
272 <xsl:with-param name="toc-context" select="$toc-context"/>
275 <xsl:variable name="nodes" select="qandadiv|qandaentry"/>
277 <xsl:if test="$nodes">
278 <fo:block id="toc.{$cid}.{$id}">
279 <xsl:attribute name="margin-{$direction.align.start}">
280 <xsl:call-template name="set.toc.indent"/>
283 <xsl:apply-templates select="$nodes" mode="toc">
284 <xsl:with-param name="toc-context" select="$toc-context"/>
285 </xsl:apply-templates>
290 <xsl:template match="qandaentry" mode="toc">
291 <xsl:apply-templates select="question" mode="toc"/>
294 <xsl:template match="question" mode="toc">
295 <xsl:variable name="firstchunk">
296 <!-- Use a titleabbrev or title if available -->
298 <xsl:when test="../blockinfo/titleabbrev">
299 <xsl:apply-templates select="../blockinfo/titleabbrev[1]/node()"/>
301 <xsl:when test="../blockinfo/title">
302 <xsl:apply-templates select="../blockinfo/title[1]/node()"/>
304 <xsl:when test="../info/titleabbrev">
305 <xsl:apply-templates select="../info/titleabbrev[1]/node()"/>
307 <xsl:when test="../titleabbrev">
308 <xsl:apply-templates select="../titleabbrev[1]/node()"/>
310 <xsl:when test="../info/title">
311 <xsl:apply-templates select="../info/title[1]/node()"/>
313 <xsl:when test="../title">
314 <xsl:apply-templates select="../title[1]/node()"/>
317 <xsl:apply-templates select="(*[local-name(.)!='label'])[1]/node()"/>
322 <xsl:variable name="deflabel">
324 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
325 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
329 <xsl:value-of select="$qanda.defaultlabel"/>
334 <xsl:variable name="id">
335 <xsl:call-template name="object.id"/>
338 <xsl:variable name="label">
339 <xsl:apply-templates select="." mode="label.markup"/>
342 <fo:block xsl:use-attribute-sets="toc.line.properties"
343 end-indent="{$toc.indent.width}pt"
344 last-line-end-indent="-{$toc.indent.width}pt">
345 <xsl:attribute name="margin-{$direction.align.start}">3em</xsl:attribute>
346 <xsl:attribute name="text-indent">-3em</xsl:attribute>
347 <fo:inline keep-with-next.within-line="always">
348 <fo:basic-link internal-destination="{$id}">
349 <xsl:if test="$label != ''">
350 <xsl:copy-of select="$label"/>
351 <xsl:if test="$deflabel = 'number' and not(label)">
352 <xsl:value-of select="$autotoc.label.separator"/>
354 <xsl:text> </xsl:text>
356 <xsl:copy-of select="$firstchunk"/>
359 <fo:inline keep-together.within-line="always">
360 <xsl:text> </xsl:text>
361 <fo:leader leader-pattern="dots"
362 leader-pattern-width="3pt"
363 leader-alignment="reference-area"
364 keep-with-next.within-line="always"/>
365 <xsl:text> </xsl:text>
366 <fo:basic-link internal-destination="{$id}">
367 <fo:page-number-citation ref-id="{$id}"/>
374 <!-- ==================================================================== -->
376 <xsl:template match="book|setindex" mode="toc">
377 <xsl:param name="toc-context" select="."/>
379 <xsl:variable name="id">
380 <xsl:call-template name="object.id"/>
383 <xsl:variable name="cid">
384 <xsl:call-template name="object.id">
385 <xsl:with-param name="object" select="$toc-context"/>
389 <xsl:call-template name="toc.line">
390 <xsl:with-param name="toc-context" select="$toc-context"/>
393 <xsl:variable name="nodes" select="glossary|bibliography|preface|chapter
394 |reference|part|article|topic|appendix|index"/>
396 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
398 <xsl:if test="$toc.max.depth > $depth.from.context
400 <fo:block id="toc.{$cid}.{$id}">
401 <xsl:attribute name="margin-{$direction.align.start}">
402 <xsl:call-template name="set.toc.indent"/>
405 <xsl:apply-templates select="$nodes" mode="toc">
406 <xsl:with-param name="toc-context" select="$toc-context"/>
407 </xsl:apply-templates>
412 <xsl:template match="set" mode="toc">
413 <xsl:param name="toc-context" select="."/>
415 <xsl:variable name="id">
416 <xsl:call-template name="object.id"/>
419 <xsl:variable name="cid">
420 <xsl:call-template name="object.id">
421 <xsl:with-param name="object" select="$toc-context"/>
425 <xsl:call-template name="toc.line">
426 <xsl:with-param name="toc-context" select="$toc-context"/>
429 <xsl:variable name="nodes" select="set|book|setindex"/>
431 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
433 <xsl:if test="$toc.max.depth > $depth.from.context
435 <fo:block id="toc.{$cid}.{$id}">
436 <xsl:attribute name="margin-{$direction.align.start}">
437 <xsl:call-template name="set.toc.indent"/>
440 <xsl:apply-templates select="$nodes" mode="toc">
441 <xsl:with-param name="toc-context" select="$toc-context"/>
442 </xsl:apply-templates>
447 <xsl:template match="part" mode="toc">
448 <xsl:param name="toc-context" select="."/>
450 <xsl:variable name="id">
451 <xsl:call-template name="object.id"/>
454 <xsl:variable name="cid">
455 <xsl:call-template name="object.id">
456 <xsl:with-param name="object" select="$toc-context"/>
460 <xsl:call-template name="toc.line">
461 <xsl:with-param name="toc-context" select="$toc-context"/>
464 <xsl:variable name="nodes" select="chapter|appendix|preface|reference|
465 refentry|article|topic|index|glossary|
468 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
470 <xsl:if test="$toc.max.depth > $depth.from.context
472 <fo:block id="toc.{$cid}.{$id}">
473 <xsl:attribute name="margin-{$direction.align.start}">
474 <xsl:call-template name="set.toc.indent"/>
477 <xsl:apply-templates select="$nodes" mode="toc">
478 <xsl:with-param name="toc-context" select="$toc-context"/>
479 </xsl:apply-templates>
484 <xsl:template match="reference" mode="toc">
485 <xsl:param name="toc-context" select="."/>
487 <xsl:variable name="id">
488 <xsl:call-template name="object.id"/>
491 <xsl:variable name="cid">
492 <xsl:call-template name="object.id">
493 <xsl:with-param name="object" select="$toc-context"/>
497 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
499 <xsl:call-template name="toc.line">
500 <xsl:with-param name="toc-context" select="$toc-context"/>
503 <xsl:if test="$toc.section.depth > 0
504 and $toc.max.depth > $depth.from.context
506 <fo:block id="toc.{$cid}.{$id}">
507 <xsl:attribute name="margin-{$direction.align.start}">
508 <xsl:call-template name="set.toc.indent"/>
511 <xsl:apply-templates select="refentry" mode="toc">
512 <xsl:with-param name="toc-context" select="$toc-context"/>
513 </xsl:apply-templates>
518 <xsl:template match="refentry" mode="toc">
519 <xsl:param name="toc-context" select="."/>
521 <xsl:call-template name="toc.line">
522 <xsl:with-param name="toc-context" select="$toc-context"/>
526 <xsl:template match="preface|chapter|appendix|article"
528 <xsl:param name="toc-context" select="."/>
530 <xsl:variable name="id">
531 <xsl:call-template name="object.id"/>
534 <xsl:variable name="cid">
535 <xsl:call-template name="object.id">
536 <xsl:with-param name="object" select="$toc-context"/>
540 <xsl:call-template name="toc.line">
541 <xsl:with-param name="toc-context" select="$toc-context"/>
544 <xsl:variable name="nodes" select="section|sect1
545 |qandaset[$qanda.in.toc != 0]
546 |simplesect[$simplesect.in.toc != 0]
548 |refentry|appendix"/>
550 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
552 <xsl:if test="$toc.section.depth > 0
553 and $toc.max.depth > $depth.from.context
555 <fo:block id="toc.{$cid}.{$id}">
556 <xsl:attribute name="margin-{$direction.align.start}">
557 <xsl:call-template name="set.toc.indent"/>
560 <xsl:apply-templates select="$nodes" mode="toc">
561 <xsl:with-param name="toc-context" select="$toc-context"/>
562 </xsl:apply-templates>
567 <xsl:template match="sect1" mode="toc">
568 <xsl:param name="toc-context" select="."/>
570 <xsl:variable name="id">
571 <xsl:call-template name="object.id"/>
574 <xsl:variable name="cid">
575 <xsl:call-template name="object.id">
576 <xsl:with-param name="object" select="$toc-context"/>
580 <xsl:call-template name="toc.line">
581 <xsl:with-param name="toc-context" select="$toc-context"/>
584 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
586 <xsl:if test="$toc.section.depth > 1
587 and $toc.max.depth > $depth.from.context
589 <fo:block id="toc.{$cid}.{$id}">
590 <xsl:attribute name="margin-{$direction.align.start}">
591 <xsl:call-template name="set.toc.indent"/>
594 <xsl:apply-templates select="sect2|qandaset[$qanda.in.toc != 0]"
596 <xsl:with-param name="toc-context" select="$toc-context"/>
597 </xsl:apply-templates>
602 <xsl:template match="sect2" mode="toc">
603 <xsl:param name="toc-context" select="."/>
605 <xsl:variable name="id">
606 <xsl:call-template name="object.id"/>
609 <xsl:variable name="cid">
610 <xsl:call-template name="object.id">
611 <xsl:with-param name="object" select="$toc-context"/>
615 <xsl:call-template name="toc.line">
616 <xsl:with-param name="toc-context" select="$toc-context"/>
619 <xsl:variable name="reldepth"
620 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
622 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
624 <xsl:if test="$toc.section.depth > 2
625 and $toc.max.depth > $depth.from.context
627 <fo:block id="toc.{$cid}.{$id}">
628 <xsl:attribute name="margin-{$direction.align.start}">
629 <xsl:call-template name="set.toc.indent">
630 <xsl:with-param name="reldepth" select="$reldepth"/>
634 <xsl:apply-templates select="sect3|qandaset[$qanda.in.toc != 0]"
636 <xsl:with-param name="toc-context" select="$toc-context"/>
637 </xsl:apply-templates>
642 <xsl:template match="sect3" mode="toc">
643 <xsl:param name="toc-context" select="."/>
645 <xsl:variable name="id">
646 <xsl:call-template name="object.id"/>
649 <xsl:variable name="cid">
650 <xsl:call-template name="object.id">
651 <xsl:with-param name="object" select="$toc-context"/>
655 <xsl:call-template name="toc.line">
656 <xsl:with-param name="toc-context" select="$toc-context"/>
659 <xsl:variable name="reldepth"
660 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
662 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
664 <xsl:if test="$toc.section.depth > 3
665 and $toc.max.depth > $depth.from.context
667 <fo:block id="toc.{$cid}.{$id}">
668 <xsl:attribute name="margin-{$direction.align.start}">
669 <xsl:call-template name="set.toc.indent">
670 <xsl:with-param name="reldepth" select="$reldepth"/>
674 <xsl:apply-templates select="sect4|qandaset[$qanda.in.toc != 0]"
676 <xsl:with-param name="toc-context" select="$toc-context"/>
677 </xsl:apply-templates>
682 <xsl:template match="sect4" mode="toc">
683 <xsl:param name="toc-context" select="."/>
685 <xsl:variable name="id">
686 <xsl:call-template name="object.id"/>
689 <xsl:variable name="cid">
690 <xsl:call-template name="object.id">
691 <xsl:with-param name="object" select="$toc-context"/>
695 <xsl:call-template name="toc.line">
696 <xsl:with-param name="toc-context" select="$toc-context"/>
699 <xsl:variable name="reldepth"
700 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
702 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
704 <xsl:if test="$toc.section.depth > 4
705 and $toc.max.depth > $depth.from.context
707 <fo:block id="toc.{$cid}.{$id}">
708 <xsl:attribute name="margin-{$direction.align.start}">
709 <xsl:call-template name="set.toc.indent">
710 <xsl:with-param name="reldepth" select="$reldepth"/>
714 <xsl:apply-templates select="sect5|qandaset[$qanda.in.toc != 0]"
716 <xsl:with-param name="toc-context" select="$toc-context"/>
717 </xsl:apply-templates>
722 <xsl:template match="sect5|simplesect" mode="toc">
723 <xsl:param name="toc-context" select="."/>
725 <xsl:call-template name="toc.line">
726 <xsl:with-param name="toc-context" select="$toc-context"/>
730 <xsl:template match="topic" mode="toc">
731 <xsl:param name="toc-context" select="."/>
733 <xsl:call-template name="toc.line">
734 <xsl:with-param name="toc-context" select="$toc-context"/>
738 <xsl:template name="set.toc.indent">
739 <xsl:param name="reldepth"/>
741 <xsl:variable name="depth">
743 <xsl:when test="$reldepth != ''">
744 <xsl:value-of select="$reldepth"/>
747 <xsl:value-of select="count(ancestor::*)"/>
753 <xsl:when test="$fop.extensions != 0 or $passivetex.extensions != 0">
754 <xsl:value-of select="concat($depth*$toc.indent.width, 'pt')"/>
757 <xsl:value-of select="concat($toc.indent.width, 'pt')"/>
763 <xsl:template match="section" mode="toc">
764 <xsl:param name="toc-context" select="."/>
766 <xsl:variable name="id">
767 <xsl:call-template name="object.id"/>
770 <xsl:variable name="cid">
771 <xsl:call-template name="object.id">
772 <xsl:with-param name="object" select="$toc-context"/>
776 <xsl:variable name="depth" select="count(ancestor::section) + 1"/>
777 <xsl:variable name="reldepth"
778 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
780 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
782 <xsl:if test="$toc.section.depth >= $depth">
783 <xsl:call-template name="toc.line">
784 <xsl:with-param name="toc-context" select="$toc-context"/>
787 <xsl:if test="$toc.section.depth > $depth
788 and $toc.max.depth > $depth.from.context
790 <fo:block id="toc.{$cid}.{$id}">
791 <xsl:attribute name="margin-{$direction.align.start}">
792 <xsl:call-template name="set.toc.indent">
793 <xsl:with-param name="reldepth" select="$reldepth"/>
797 <xsl:apply-templates select="section|qandaset[$qanda.in.toc != 0]"
799 <xsl:with-param name="toc-context" select="$toc-context"/>
800 </xsl:apply-templates>
806 <xsl:template match="bibliography|glossary"
808 <xsl:param name="toc-context" select="."/>
810 <xsl:call-template name="toc.line">
811 <xsl:with-param name="toc-context" select="$toc-context"/>
815 <xsl:template match="index" mode="toc">
816 <xsl:param name="toc-context" select="."/>
818 <xsl:if test="* or $generate.index != 0">
819 <xsl:call-template name="toc.line">
820 <xsl:with-param name="toc-context" select="$toc-context"/>
825 <xsl:template match="title" mode="toc">
826 <xsl:apply-templates/>
829 <!-- ==================================================================== -->
831 <xsl:template name="list.of.titles">
832 <xsl:param name="titles" select="'table'"/>
833 <xsl:param name="nodes" select=".//table"/>
834 <xsl:param name="toc-context" select="."/>
836 <xsl:variable name="id">
837 <xsl:call-template name="object.id"/>
840 <xsl:if test="$nodes">
841 <fo:block id="lot...{$titles}...{$id}">
843 <xsl:when test="$titles='table'">
844 <xsl:call-template name="list.of.tables.titlepage"/>
846 <xsl:when test="$titles='figure'">
847 <xsl:call-template name="list.of.figures.titlepage"/>
849 <xsl:when test="$titles='equation'">
850 <xsl:call-template name="list.of.equations.titlepage"/>
852 <xsl:when test="$titles='example'">
853 <xsl:call-template name="list.of.examples.titlepage"/>
855 <xsl:when test="$titles='procedure'">
856 <xsl:call-template name="list.of.procedures.titlepage"/>
859 <xsl:call-template name="list.of.unknowns.titlepage"/>
862 <xsl:apply-templates select="$nodes" mode="toc">
863 <xsl:with-param name="toc-context" select="$toc-context"/>
864 </xsl:apply-templates>
869 <xsl:template name="component.list.of.titles">
870 <xsl:param name="titles" select="'table'"/>
871 <xsl:param name="nodes" select=".//table"/>
872 <xsl:param name="toc-context" select="."/>
874 <xsl:variable name="id">
875 <xsl:call-template name="object.id"/>
878 <xsl:if test="$nodes">
879 <fo:block id="lot...{$titles}...{$id}">
881 <xsl:when test="$titles='table'">
882 <xsl:call-template name="component.list.of.tables.titlepage"/>
884 <xsl:when test="$titles='figure'">
885 <xsl:call-template name="component.list.of.figures.titlepage"/>
887 <xsl:when test="$titles='equation'">
888 <xsl:call-template name="component.list.of.equations.titlepage"/>
890 <xsl:when test="$titles='example'">
891 <xsl:call-template name="component.list.of.examples.titlepage"/>
893 <xsl:when test="$titles='procedure'">
894 <xsl:call-template name="component.list.of.procedures.titlepage"/>
897 <xsl:call-template name="component.list.of.unknowns.titlepage"/>
900 <xsl:apply-templates select="$nodes" mode="toc">
901 <xsl:with-param name="toc-context" select="$toc-context"/>
902 </xsl:apply-templates>
907 <xsl:template match="figure|table|example|equation|procedure" mode="toc">
908 <xsl:param name="toc-context" select="."/>
909 <xsl:call-template name="toc.line">
910 <xsl:with-param name="toc-context" select="$toc-context"/>
914 <!-- ==================================================================== -->
916 <!-- qandaset handled like a section when qanda.in.toc is set -->
917 <xsl:template match="qandaset" mode="toc">
918 <xsl:param name="toc-context" select="."/>
920 <xsl:variable name="id">
921 <xsl:call-template name="object.id"/>
924 <xsl:variable name="cid">
925 <xsl:call-template name="object.id">
926 <xsl:with-param name="object" select="$toc-context"/>
930 <xsl:variable name="depth" select="count(ancestor::section) + 1"/>
931 <xsl:variable name="reldepth"
932 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
934 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
936 <xsl:if test="$toc.section.depth >= $depth">
937 <xsl:call-template name="toc.line">
938 <xsl:with-param name="toc-context" select="$toc-context"/>
941 <xsl:if test="$toc.section.depth > $depth
942 and $toc.max.depth > $depth.from.context
943 and (child::qandadiv or child::qandaentry)">
944 <fo:block id="toc.{$cid}.{$id}">
945 <xsl:attribute name="margin-{$direction.align.start}">
946 <xsl:call-template name="set.toc.indent">
947 <xsl:with-param name="reldepth" select="$reldepth"/>
951 <xsl:apply-templates select="qandadiv|qandaentry" mode="toc">
952 <xsl:with-param name="toc-context" select="$toc-context"/>
953 </xsl:apply-templates>