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 8286 2009-03-06 22:53:04Z 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
72 |$toc-context/bibliography
73 |$toc-context/glossary
74 |$toc-context/index"/>
76 <xsl:if test="$nodes">
77 <fo:block id="toc...{$cid}"
78 xsl:use-attribute-sets="toc.margin.properties">
79 <xsl:if test="$axf.extensions != 0">
80 <xsl:attribute name="axf:outline-level">1</xsl:attribute>
81 <xsl:attribute name="axf:outline-expand">false</xsl:attribute>
82 <xsl:attribute name="axf:outline-title">
83 <xsl:call-template name="gentext">
84 <xsl:with-param name="key" select="'TableofContents'"/>
88 <xsl:if test="$toc.title.p">
89 <xsl:call-template name="table.of.contents.titlepage"/>
91 <xsl:apply-templates select="$nodes" mode="toc">
92 <xsl:with-param name="toc-context" select="$toc-context"/>
93 </xsl:apply-templates>
98 <xsl:template name="component.toc">
99 <xsl:param name="toc-context" select="."/>
100 <xsl:param name="toc.title.p" select="true()"/>
102 <xsl:variable name="id">
103 <xsl:call-template name="object.id"/>
106 <xsl:variable name="cid">
107 <xsl:call-template name="object.id">
108 <xsl:with-param name="object" select="$toc-context"/>
112 <xsl:variable name="nodes" select="section|sect1|refentry
113 |article|bibliography|glossary
114 |qandaset[$qanda.in.toc != 0]
116 <xsl:if test="$nodes">
117 <fo:block id="toc...{$id}"
118 xsl:use-attribute-sets="toc.margin.properties">
119 <xsl:if test="$toc.title.p">
120 <xsl:call-template name="table.of.contents.titlepage"/>
122 <xsl:apply-templates select="$nodes" mode="toc">
123 <xsl:with-param name="toc-context" select="$toc-context"/>
124 </xsl:apply-templates>
129 <xsl:template name="component.toc.separator">
130 <!-- Customize to output something between
131 component.toc and first output -->
134 <xsl:template name="section.toc">
135 <xsl:param name="toc-context" select="."/>
136 <xsl:param name="toc.title.p" select="true()"/>
138 <xsl:variable name="id">
139 <xsl:call-template name="object.id"/>
142 <xsl:variable name="cid">
143 <xsl:call-template name="object.id">
144 <xsl:with-param name="object" select="$toc-context"/>
148 <xsl:variable name="nodes"
149 select="section|sect1|sect2|sect3|sect4|sect5|refentry
150 |qandaset[$qanda.in.toc != 0]
151 |bridgehead[$bridgehead.in.toc != 0]"/>
153 <xsl:variable name="level">
154 <xsl:call-template name="section.level"/>
157 <xsl:if test="$nodes">
158 <fo:block id="toc...{$id}"
159 xsl:use-attribute-sets="toc.margin.properties">
161 <xsl:if test="$toc.title.p">
162 <xsl:call-template name="section.heading">
163 <xsl:with-param name="level" select="$level + 1"/>
164 <xsl:with-param name="title">
165 <fo:block space-after="0.5em">
166 <xsl:call-template name="gentext">
167 <xsl:with-param name="key" select="'TableofContents'"/>
174 <xsl:apply-templates select="$nodes" mode="toc">
175 <xsl:with-param name="toc-context" select="$toc-context"/>
176 </xsl:apply-templates>
181 <xsl:template name="section.toc.separator">
182 <!-- Customize to output something between
183 section.toc and first output -->
185 <!-- ==================================================================== -->
187 <xsl:template name="toc.line">
188 <xsl:param name="toc-context" select="NOTANODE"/>
190 <xsl:variable name="id">
191 <xsl:call-template name="object.id"/>
194 <xsl:variable name="label">
195 <xsl:apply-templates select="." mode="label.markup"/>
198 <fo:block xsl:use-attribute-sets="toc.line.properties">
199 <fo:inline keep-with-next.within-line="always">
200 <fo:basic-link internal-destination="{$id}">
201 <xsl:if test="$label != ''">
202 <xsl:copy-of select="$label"/>
203 <xsl:value-of select="$autotoc.label.separator"/>
205 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
208 <fo:inline keep-together.within-line="always">
209 <xsl:text> </xsl:text>
210 <fo:leader leader-pattern="dots"
211 leader-pattern-width="3pt"
212 leader-alignment="reference-area"
213 keep-with-next.within-line="always"/>
214 <xsl:text> </xsl:text>
215 <fo:basic-link internal-destination="{$id}">
216 <fo:page-number-citation ref-id="{$id}"/>
222 <!-- ==================================================================== -->
223 <xsl:template name="qandaset.toc">
224 <xsl:param name="toc-context" select="."/>
225 <xsl:param name="toc.title.p" select="true()"/>
227 <xsl:variable name="id">
228 <xsl:call-template name="object.id"/>
231 <xsl:variable name="cid">
232 <xsl:call-template name="object.id">
233 <xsl:with-param name="object" select="$toc-context"/>
237 <xsl:variable name="nodes" select="qandadiv|qandaentry"/>
239 <xsl:if test="$nodes">
240 <fo:block id="toc...{$id}"
241 xsl:use-attribute-sets="toc.margin.properties">
242 <xsl:if test="$toc.title.p">
243 <xsl:call-template name="table.of.contents.titlepage"/>
245 <xsl:apply-templates select="$nodes" mode="toc">
246 <xsl:with-param name="toc-context" select="$toc-context"/>
247 </xsl:apply-templates>
252 <xsl:template name="qandaset.toc.separator">
253 <!-- Customize to output something between
254 qandaset.toc and first output -->
257 <xsl:template match="qandadiv" mode="toc">
258 <xsl:param name="toc-context" select="."/>
260 <xsl:variable name="id">
261 <xsl:call-template name="object.id"/>
264 <xsl:variable name="cid">
265 <xsl:call-template name="object.id">
266 <xsl:with-param name="object" select="$toc-context"/>
270 <xsl:call-template name="toc.line">
271 <xsl:with-param name="toc-context" select="$toc-context"/>
274 <xsl:variable name="nodes" select="qandadiv|qandaentry"/>
276 <xsl:if test="$nodes">
277 <fo:block id="toc.{$cid}.{$id}">
278 <xsl:attribute name="margin-{$direction.align.start}">
279 <xsl:call-template name="set.toc.indent"/>
282 <xsl:apply-templates select="$nodes" mode="toc">
283 <xsl:with-param name="toc-context" select="$toc-context"/>
284 </xsl:apply-templates>
289 <xsl:template match="qandaentry" mode="toc">
290 <xsl:apply-templates select="question" mode="toc"/>
293 <xsl:template match="question" mode="toc">
294 <xsl:variable name="firstchunk">
295 <!-- Use a titleabbrev or title if available -->
297 <xsl:when test="../blockinfo/titleabbrev">
298 <xsl:apply-templates select="../blockinfo/titleabbrev[1]/node()"/>
300 <xsl:when test="../blockinfo/title">
301 <xsl:apply-templates select="../blockinfo/title[1]/node()"/>
303 <xsl:when test="../info/titleabbrev">
304 <xsl:apply-templates select="../info/titleabbrev[1]/node()"/>
306 <xsl:when test="../titleabbrev">
307 <xsl:apply-templates select="../titleabbrev[1]/node()"/>
309 <xsl:when test="../info/title">
310 <xsl:apply-templates select="../info/title[1]/node()"/>
312 <xsl:when test="../title">
313 <xsl:apply-templates select="../title[1]/node()"/>
316 <xsl:apply-templates select="(*[local-name(.)!='label'])[1]/node()"/>
321 <xsl:variable name="deflabel">
323 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
324 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
328 <xsl:value-of select="$qanda.defaultlabel"/>
333 <xsl:variable name="id">
334 <xsl:call-template name="object.id"/>
337 <xsl:variable name="label">
338 <xsl:apply-templates select="." mode="label.markup"/>
341 <fo:block xsl:use-attribute-sets="toc.line.properties"
342 end-indent="{$toc.indent.width}pt"
343 last-line-end-indent="-{$toc.indent.width}pt">
344 <xsl:attribute name="margin-{$direction.align.start}">3em</xsl:attribute>
345 <xsl:attribute name="text-indent">-3em</xsl:attribute>
346 <fo:inline keep-with-next.within-line="always">
347 <fo:basic-link internal-destination="{$id}">
348 <xsl:if test="$label != ''">
349 <xsl:copy-of select="$label"/>
350 <xsl:if test="$deflabel = 'number' and not(label)">
351 <xsl:value-of select="$autotoc.label.separator"/>
353 <xsl:text> </xsl:text>
355 <xsl:copy-of select="$firstchunk"/>
358 <fo:inline keep-together.within-line="always">
359 <xsl:text> </xsl:text>
360 <fo:leader leader-pattern="dots"
361 leader-pattern-width="3pt"
362 leader-alignment="reference-area"
363 keep-with-next.within-line="always"/>
364 <xsl:text> </xsl:text>
365 <fo:basic-link internal-destination="{$id}">
366 <fo:page-number-citation ref-id="{$id}"/>
373 <!-- ==================================================================== -->
375 <xsl:template match="book|setindex" mode="toc">
376 <xsl:param name="toc-context" select="."/>
378 <xsl:variable name="id">
379 <xsl:call-template name="object.id"/>
382 <xsl:variable name="cid">
383 <xsl:call-template name="object.id">
384 <xsl:with-param name="object" select="$toc-context"/>
388 <xsl:call-template name="toc.line">
389 <xsl:with-param name="toc-context" select="$toc-context"/>
392 <xsl:variable name="nodes" select="glossary|bibliography|preface|chapter
393 |reference|part|article|appendix|index"/>
395 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
397 <xsl:if test="$toc.section.depth > 0
398 and $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.section.depth > 0
434 and $toc.max.depth > $depth.from.context
436 <fo:block id="toc.{$cid}.{$id}">
437 <xsl:attribute name="margin-{$direction.align.start}">
438 <xsl:call-template name="set.toc.indent"/>
441 <xsl:apply-templates select="$nodes" mode="toc">
442 <xsl:with-param name="toc-context" select="$toc-context"/>
443 </xsl:apply-templates>
448 <xsl:template match="part" mode="toc">
449 <xsl:param name="toc-context" select="."/>
451 <xsl:variable name="id">
452 <xsl:call-template name="object.id"/>
455 <xsl:variable name="cid">
456 <xsl:call-template name="object.id">
457 <xsl:with-param name="object" select="$toc-context"/>
461 <xsl:call-template name="toc.line">
462 <xsl:with-param name="toc-context" select="$toc-context"/>
465 <xsl:variable name="nodes" select="chapter|appendix|preface|reference|
466 refentry|article|index|glossary|
469 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
471 <xsl:if test="$toc.section.depth > 0
472 and $toc.max.depth > $depth.from.context
474 <fo:block id="toc.{$cid}.{$id}">
475 <xsl:attribute name="margin-{$direction.align.start}">
476 <xsl:call-template name="set.toc.indent"/>
479 <xsl:apply-templates select="$nodes" mode="toc">
480 <xsl:with-param name="toc-context" select="$toc-context"/>
481 </xsl:apply-templates>
486 <xsl:template match="reference" mode="toc">
487 <xsl:param name="toc-context" select="."/>
489 <xsl:variable name="id">
490 <xsl:call-template name="object.id"/>
493 <xsl:variable name="cid">
494 <xsl:call-template name="object.id">
495 <xsl:with-param name="object" select="$toc-context"/>
499 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
501 <xsl:call-template name="toc.line">
502 <xsl:with-param name="toc-context" select="$toc-context"/>
505 <xsl:if test="$toc.section.depth > 0
506 and $toc.max.depth > $depth.from.context
508 <fo:block id="toc.{$cid}.{$id}">
509 <xsl:attribute name="margin-{$direction.align.start}">
510 <xsl:call-template name="set.toc.indent"/>
513 <xsl:apply-templates select="refentry" mode="toc">
514 <xsl:with-param name="toc-context" select="$toc-context"/>
515 </xsl:apply-templates>
520 <xsl:template match="refentry" mode="toc">
521 <xsl:param name="toc-context" select="."/>
523 <xsl:call-template name="toc.line">
524 <xsl:with-param name="toc-context" select="$toc-context"/>
528 <xsl:template match="preface|chapter|appendix|article"
530 <xsl:param name="toc-context" select="."/>
532 <xsl:variable name="id">
533 <xsl:call-template name="object.id"/>
536 <xsl:variable name="cid">
537 <xsl:call-template name="object.id">
538 <xsl:with-param name="object" select="$toc-context"/>
542 <xsl:call-template name="toc.line">
543 <xsl:with-param name="toc-context" select="$toc-context"/>
546 <xsl:variable name="nodes" select="section|sect1
547 |qandaset[$qanda.in.toc != 0]
548 |simplesect[$simplesect.in.toc != 0]
549 |refentry|appendix"/>
551 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
553 <xsl:if test="$toc.section.depth > 0
554 and $toc.max.depth > $depth.from.context
556 <fo:block id="toc.{$cid}.{$id}">
557 <xsl:attribute name="margin-{$direction.align.start}">
558 <xsl:call-template name="set.toc.indent"/>
561 <xsl:apply-templates select="$nodes" mode="toc">
562 <xsl:with-param name="toc-context" select="$toc-context"/>
563 </xsl:apply-templates>
568 <xsl:template match="sect1" mode="toc">
569 <xsl:param name="toc-context" select="."/>
571 <xsl:variable name="id">
572 <xsl:call-template name="object.id"/>
575 <xsl:variable name="cid">
576 <xsl:call-template name="object.id">
577 <xsl:with-param name="object" select="$toc-context"/>
581 <xsl:call-template name="toc.line">
582 <xsl:with-param name="toc-context" select="$toc-context"/>
585 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
587 <xsl:if test="$toc.section.depth > 1
588 and $toc.max.depth > $depth.from.context
590 <fo:block id="toc.{$cid}.{$id}">
591 <xsl:attribute name="margin-{$direction.align.start}">
592 <xsl:call-template name="set.toc.indent"/>
595 <xsl:apply-templates select="sect2|qandaset[$qanda.in.toc != 0]"
597 <xsl:with-param name="toc-context" select="$toc-context"/>
598 </xsl:apply-templates>
603 <xsl:template match="sect2" mode="toc">
604 <xsl:param name="toc-context" select="."/>
606 <xsl:variable name="id">
607 <xsl:call-template name="object.id"/>
610 <xsl:variable name="cid">
611 <xsl:call-template name="object.id">
612 <xsl:with-param name="object" select="$toc-context"/>
616 <xsl:call-template name="toc.line">
617 <xsl:with-param name="toc-context" select="$toc-context"/>
620 <xsl:variable name="reldepth"
621 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
623 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
625 <xsl:if test="$toc.section.depth > 2
626 and $toc.max.depth > $depth.from.context
628 <fo:block id="toc.{$cid}.{$id}">
629 <xsl:attribute name="margin-{$direction.align.start}">
630 <xsl:call-template name="set.toc.indent">
631 <xsl:with-param name="reldepth" select="$reldepth"/>
635 <xsl:apply-templates select="sect3|qandaset[$qanda.in.toc != 0]"
637 <xsl:with-param name="toc-context" select="$toc-context"/>
638 </xsl:apply-templates>
643 <xsl:template match="sect3" mode="toc">
644 <xsl:param name="toc-context" select="."/>
646 <xsl:variable name="id">
647 <xsl:call-template name="object.id"/>
650 <xsl:variable name="cid">
651 <xsl:call-template name="object.id">
652 <xsl:with-param name="object" select="$toc-context"/>
656 <xsl:call-template name="toc.line">
657 <xsl:with-param name="toc-context" select="$toc-context"/>
660 <xsl:variable name="reldepth"
661 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
663 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
665 <xsl:if test="$toc.section.depth > 3
666 and $toc.max.depth > $depth.from.context
668 <fo:block id="toc.{$cid}.{$id}">
669 <xsl:attribute name="margin-{$direction.align.start}">
670 <xsl:call-template name="set.toc.indent">
671 <xsl:with-param name="reldepth" select="$reldepth"/>
675 <xsl:apply-templates select="sect4|qandaset[$qanda.in.toc != 0]"
677 <xsl:with-param name="toc-context" select="$toc-context"/>
678 </xsl:apply-templates>
683 <xsl:template match="sect4" mode="toc">
684 <xsl:param name="toc-context" select="."/>
686 <xsl:variable name="id">
687 <xsl:call-template name="object.id"/>
690 <xsl:variable name="cid">
691 <xsl:call-template name="object.id">
692 <xsl:with-param name="object" select="$toc-context"/>
696 <xsl:call-template name="toc.line">
697 <xsl:with-param name="toc-context" select="$toc-context"/>
700 <xsl:variable name="reldepth"
701 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
703 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
705 <xsl:if test="$toc.section.depth > 4
706 and $toc.max.depth > $depth.from.context
708 <fo:block id="toc.{$cid}.{$id}">
709 <xsl:attribute name="margin-{$direction.align.start}">
710 <xsl:call-template name="set.toc.indent">
711 <xsl:with-param name="reldepth" select="$reldepth"/>
715 <xsl:apply-templates select="sect5|qandaset[$qanda.in.toc != 0]"
717 <xsl:with-param name="toc-context" select="$toc-context"/>
718 </xsl:apply-templates>
723 <xsl:template match="sect5|simplesect" mode="toc">
724 <xsl:param name="toc-context" select="."/>
726 <xsl:call-template name="toc.line">
727 <xsl:with-param name="toc-context" select="$toc-context"/>
731 <xsl:template name="set.toc.indent">
732 <xsl:param name="reldepth"/>
734 <xsl:variable name="depth">
736 <xsl:when test="$reldepth != ''">
737 <xsl:value-of select="$reldepth"/>
740 <xsl:value-of select="count(ancestor::*)"/>
746 <xsl:when test="$fop.extensions != 0 or $passivetex.extensions != 0">
747 <xsl:value-of select="concat($depth*$toc.indent.width, 'pt')"/>
750 <xsl:value-of select="concat($toc.indent.width, 'pt')"/>
756 <xsl:template match="section" mode="toc">
757 <xsl:param name="toc-context" select="."/>
759 <xsl:variable name="id">
760 <xsl:call-template name="object.id"/>
763 <xsl:variable name="cid">
764 <xsl:call-template name="object.id">
765 <xsl:with-param name="object" select="$toc-context"/>
769 <xsl:variable name="depth" select="count(ancestor::section) + 1"/>
770 <xsl:variable name="reldepth"
771 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
773 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
775 <xsl:if test="$toc.section.depth >= $depth">
776 <xsl:call-template name="toc.line">
777 <xsl:with-param name="toc-context" select="$toc-context"/>
780 <xsl:if test="$toc.section.depth > $depth
781 and $toc.max.depth > $depth.from.context
783 <fo:block id="toc.{$cid}.{$id}">
784 <xsl:attribute name="margin-{$direction.align.start}">
785 <xsl:call-template name="set.toc.indent">
786 <xsl:with-param name="reldepth" select="$reldepth"/>
790 <xsl:apply-templates select="section|qandaset[$qanda.in.toc != 0]"
792 <xsl:with-param name="toc-context" select="$toc-context"/>
793 </xsl:apply-templates>
799 <xsl:template match="bibliography|glossary"
801 <xsl:param name="toc-context" select="."/>
803 <xsl:call-template name="toc.line">
804 <xsl:with-param name="toc-context" select="$toc-context"/>
808 <xsl:template match="index" mode="toc">
809 <xsl:param name="toc-context" select="."/>
811 <xsl:if test="* or $generate.index != 0">
812 <xsl:call-template name="toc.line">
813 <xsl:with-param name="toc-context" select="$toc-context"/>
818 <xsl:template match="title" mode="toc">
819 <xsl:apply-templates/>
822 <!-- ==================================================================== -->
824 <xsl:template name="list.of.titles">
825 <xsl:param name="titles" select="'table'"/>
826 <xsl:param name="nodes" select=".//table"/>
827 <xsl:param name="toc-context" select="."/>
829 <xsl:variable name="id">
830 <xsl:call-template name="object.id"/>
833 <xsl:if test="$nodes">
834 <fo:block id="lot...{$titles}...{$id}">
836 <xsl:when test="$titles='table'">
837 <xsl:call-template name="list.of.tables.titlepage"/>
839 <xsl:when test="$titles='figure'">
840 <xsl:call-template name="list.of.figures.titlepage"/>
842 <xsl:when test="$titles='equation'">
843 <xsl:call-template name="list.of.equations.titlepage"/>
845 <xsl:when test="$titles='example'">
846 <xsl:call-template name="list.of.examples.titlepage"/>
848 <xsl:when test="$titles='procedure'">
849 <xsl:call-template name="list.of.procedures.titlepage"/>
852 <xsl:call-template name="list.of.unknowns.titlepage"/>
855 <xsl:apply-templates select="$nodes" mode="toc">
856 <xsl:with-param name="toc-context" select="$toc-context"/>
857 </xsl:apply-templates>
862 <xsl:template match="figure|table|example|equation|procedure" mode="toc">
863 <xsl:param name="toc-context" select="."/>
864 <xsl:call-template name="toc.line">
865 <xsl:with-param name="toc-context" select="$toc-context"/>
869 <!-- ==================================================================== -->
871 <!-- qandaset handled like a section when qanda.in.toc is set -->
872 <xsl:template match="qandaset" mode="toc">
873 <xsl:param name="toc-context" select="."/>
875 <xsl:variable name="id">
876 <xsl:call-template name="object.id"/>
879 <xsl:variable name="cid">
880 <xsl:call-template name="object.id">
881 <xsl:with-param name="object" select="$toc-context"/>
885 <xsl:variable name="depth" select="count(ancestor::section) + 1"/>
886 <xsl:variable name="reldepth"
887 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
889 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
891 <xsl:if test="$toc.section.depth >= $depth">
892 <xsl:call-template name="toc.line">
893 <xsl:with-param name="toc-context" select="$toc-context"/>
896 <xsl:if test="$toc.section.depth > $depth
897 and $toc.max.depth > $depth.from.context
898 and (child::qandadiv or child::qandaentry)">
899 <fo:block id="toc.{$cid}.{$id}">
900 <xsl:attribute name="margin-{$direction.align.start}">
901 <xsl:call-template name="set.toc.indent">
902 <xsl:with-param name="reldepth" select="$reldepth"/>
906 <xsl:apply-templates select="qandadiv|qandaentry" mode="toc">
907 <xsl:with-param name="toc-context" select="$toc-context"/>
908 </xsl:apply-templates>