source: stylesheets/lfs-xsl/docbook-xsl-1.78.1/fo/autotoc.xsl@ 1fa2099

multilib-10.1
Last change on this file since 1fa2099 was 1fa2099, checked in by Thomas Trepl <thomas@…>, 5 years ago

Initial creation of multilib branch

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/multilib@11565 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 31.5 KB
Line 
1<?xml version='1.0'?>
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"
5 version='1.0'>
6
7<!-- ********************************************************************
8 $Id: autotoc.xsl 9647 2012-10-26 17:42:03Z bobstayton $
9 ********************************************************************
10
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.
14
15 ******************************************************************** -->
16
17<!-- ==================================================================== -->
18
19<xsl:template name="set.toc">
20
21 <xsl:param name="toc-context" select="."/>
22
23 <xsl:variable name="id">
24 <xsl:call-template name="object.id"/>
25 </xsl:variable>
26
27 <xsl:variable name="cid">
28 <xsl:call-template name="object.id">
29 <xsl:with-param name="object" select="$toc-context"/>
30 </xsl:call-template>
31 </xsl:variable>
32
33 <xsl:variable name="nodes" select="book|set|setindex"/>
34
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'"/>
44 </xsl:call-template>
45 </xsl:attribute>
46 </xsl:if>
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>
51 </fo:block>
52 </xsl:if>
53</xsl:template>
54
55<xsl:template name="division.toc">
56 <xsl:param name="toc-context" select="."/>
57 <xsl:param name="toc.title.p" select="true()"/>
58
59 <xsl:variable name="cid">
60 <xsl:call-template name="object.id">
61 <xsl:with-param name="object" select="$toc-context"/>
62 </xsl:call-template>
63 </xsl:variable>
64
65 <xsl:variable name="nodes"
66 select="$toc-context/part
67 |$toc-context/reference
68 |$toc-context/preface
69 |$toc-context/chapter
70 |$toc-context/appendix
71 |$toc-context/article
72 |$toc-context/topic
73 |$toc-context/bibliography
74 |$toc-context/glossary
75 |$toc-context/index"/>
76
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'"/>
86 </xsl:call-template>
87 </xsl:attribute>
88 </xsl:if>
89 <xsl:if test="$toc.title.p">
90 <xsl:call-template name="table.of.contents.titlepage"/>
91 </xsl:if>
92 <xsl:apply-templates select="$nodes" mode="toc">
93 <xsl:with-param name="toc-context" select="$toc-context"/>
94 </xsl:apply-templates>
95 </fo:block>
96 </xsl:if>
97</xsl:template>
98
99<xsl:template name="component.toc">
100 <xsl:param name="toc-context" select="."/>
101 <xsl:param name="toc.title.p" select="true()"/>
102
103 <xsl:variable name="id">
104 <xsl:call-template name="object.id"/>
105 </xsl:variable>
106
107 <xsl:variable name="cid">
108 <xsl:call-template name="object.id">
109 <xsl:with-param name="object" select="$toc-context"/>
110 </xsl:call-template>
111 </xsl:variable>
112
113 <xsl:variable name="nodes" select="section|sect1|refentry
114 |article|topic|bibliography|glossary
115 |qandaset[$qanda.in.toc != 0]
116 |appendix|index"/>
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"/>
122 </xsl:if>
123 <xsl:apply-templates select="$nodes" mode="toc">
124 <xsl:with-param name="toc-context" select="$toc-context"/>
125 </xsl:apply-templates>
126 </fo:block>
127 </xsl:if>
128</xsl:template>
129
130<xsl:template name="component.toc.separator">
131 <!-- Customize to output something between
132 component.toc and first output -->
133</xsl:template>
134
135<xsl:template name="section.toc">
136 <xsl:param name="toc-context" select="."/>
137 <xsl:param name="toc.title.p" select="true()"/>
138
139 <xsl:variable name="id">
140 <xsl:call-template name="object.id"/>
141 </xsl:variable>
142
143 <xsl:variable name="cid">
144 <xsl:call-template name="object.id">
145 <xsl:with-param name="object" select="$toc-context"/>
146 </xsl:call-template>
147 </xsl:variable>
148
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]"/>
153
154 <xsl:variable name="level">
155 <xsl:call-template name="section.level"/>
156 </xsl:variable>
157
158 <xsl:if test="$nodes">
159 <fo:block id="toc...{$id}"
160 xsl:use-attribute-sets="toc.margin.properties">
161
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'"/>
169 </xsl:call-template>
170 </fo:block>
171 </xsl:with-param>
172 </xsl:call-template>
173 </xsl:if>
174
175 <xsl:apply-templates select="$nodes" mode="toc">
176 <xsl:with-param name="toc-context" select="$toc-context"/>
177 </xsl:apply-templates>
178 </fo:block>
179 </xsl:if>
180</xsl:template>
181
182<xsl:template name="section.toc.separator">
183 <!-- Customize to output something between
184 section.toc and first output -->
185</xsl:template>
186<!-- ==================================================================== -->
187
188<xsl:template name="toc.line">
189 <xsl:param name="toc-context" select="NOTANODE"/>
190
191 <xsl:variable name="id">
192 <xsl:call-template name="object.id"/>
193 </xsl:variable>
194
195 <xsl:variable name="label">
196 <xsl:apply-templates select="." mode="label.markup"/>
197 </xsl:variable>
198
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"/>
205 </xsl:if>
206 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
207 </fo:basic-link>
208 </fo:inline>
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}"/>
218 </fo:basic-link>
219 </fo:inline>
220 </fo:block>
221</xsl:template>
222
223<!-- ==================================================================== -->
224<xsl:template name="qandaset.toc">
225 <xsl:param name="toc-context" select="."/>
226 <xsl:param name="toc.title.p" select="true()"/>
227
228 <xsl:variable name="id">
229 <xsl:call-template name="object.id"/>
230 </xsl:variable>
231
232 <xsl:variable name="cid">
233 <xsl:call-template name="object.id">
234 <xsl:with-param name="object" select="$toc-context"/>
235 </xsl:call-template>
236 </xsl:variable>
237
238 <xsl:variable name="nodes" select="qandadiv|qandaentry"/>
239
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"/>
245 </xsl:if>
246 <xsl:apply-templates select="$nodes" mode="toc">
247 <xsl:with-param name="toc-context" select="$toc-context"/>
248 </xsl:apply-templates>
249 </fo:block>
250 </xsl:if>
251</xsl:template>
252
253<xsl:template name="qandaset.toc.separator">
254 <!-- Customize to output something between
255 qandaset.toc and first output -->
256</xsl:template>
257
258<xsl:template match="qandadiv" mode="toc">
259 <xsl:param name="toc-context" select="."/>
260
261 <xsl:variable name="id">
262 <xsl:call-template name="object.id"/>
263 </xsl:variable>
264
265 <xsl:variable name="cid">
266 <xsl:call-template name="object.id">
267 <xsl:with-param name="object" select="$toc-context"/>
268 </xsl:call-template>
269 </xsl:variable>
270
271 <xsl:call-template name="toc.line">
272 <xsl:with-param name="toc-context" select="$toc-context"/>
273 </xsl:call-template>
274
275 <xsl:variable name="nodes" select="qandadiv|qandaentry"/>
276
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"/>
281 </xsl:attribute>
282
283 <xsl:apply-templates select="$nodes" mode="toc">
284 <xsl:with-param name="toc-context" select="$toc-context"/>
285 </xsl:apply-templates>
286 </fo:block>
287 </xsl:if>
288</xsl:template>
289
290<xsl:template match="qandaentry" mode="toc">
291 <xsl:apply-templates select="question" mode="toc"/>
292</xsl:template>
293
294<xsl:template match="question" mode="toc">
295 <xsl:variable name="firstchunk">
296 <!-- Use a titleabbrev or title if available -->
297 <xsl:choose>
298 <xsl:when test="../blockinfo/titleabbrev">
299 <xsl:apply-templates select="../blockinfo/titleabbrev[1]/node()"/>
300 </xsl:when>
301 <xsl:when test="../blockinfo/title">
302 <xsl:apply-templates select="../blockinfo/title[1]/node()"/>
303 </xsl:when>
304 <xsl:when test="../info/titleabbrev">
305 <xsl:apply-templates select="../info/titleabbrev[1]/node()"/>
306 </xsl:when>
307 <xsl:when test="../titleabbrev">
308 <xsl:apply-templates select="../titleabbrev[1]/node()"/>
309 </xsl:when>
310 <xsl:when test="../info/title">
311 <xsl:apply-templates select="../info/title[1]/node()"/>
312 </xsl:when>
313 <xsl:when test="../title">
314 <xsl:apply-templates select="../title[1]/node()"/>
315 </xsl:when>
316 <xsl:otherwise>
317 <xsl:apply-templates select="(*[local-name(.)!='label'])[1]/node()"/>
318 </xsl:otherwise>
319 </xsl:choose>
320 </xsl:variable>
321
322 <xsl:variable name="deflabel">
323 <xsl:choose>
324 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
325 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
326 /@defaultlabel"/>
327 </xsl:when>
328 <xsl:otherwise>
329 <xsl:value-of select="$qanda.defaultlabel"/>
330 </xsl:otherwise>
331 </xsl:choose>
332 </xsl:variable>
333
334 <xsl:variable name="id">
335 <xsl:call-template name="object.id"/>
336 </xsl:variable>
337
338 <xsl:variable name="label">
339 <xsl:apply-templates select="." mode="label.markup"/>
340 </xsl:variable>
341
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"/>
353 </xsl:if>
354 <xsl:text> </xsl:text>
355 </xsl:if>
356 <xsl:copy-of select="$firstchunk"/>
357 </fo:basic-link>
358 </fo:inline>
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}"/>
368 </fo:basic-link>
369 </fo:inline>
370 </fo:block>
371
372</xsl:template>
373
374<!-- ==================================================================== -->
375
376<xsl:template match="book|setindex" mode="toc">
377 <xsl:param name="toc-context" select="."/>
378
379 <xsl:variable name="id">
380 <xsl:call-template name="object.id"/>
381 </xsl:variable>
382
383 <xsl:variable name="cid">
384 <xsl:call-template name="object.id">
385 <xsl:with-param name="object" select="$toc-context"/>
386 </xsl:call-template>
387 </xsl:variable>
388
389 <xsl:call-template name="toc.line">
390 <xsl:with-param name="toc-context" select="$toc-context"/>
391 </xsl:call-template>
392
393 <xsl:variable name="nodes" select="glossary|bibliography|preface|chapter
394 |reference|part|article|topic|appendix|index"/>
395
396 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
397
398 <xsl:if test="$toc.max.depth > $depth.from.context
399 and $nodes">
400 <fo:block id="toc.{$cid}.{$id}">
401 <xsl:attribute name="margin-{$direction.align.start}">
402 <xsl:call-template name="set.toc.indent"/>
403 </xsl:attribute>
404
405 <xsl:apply-templates select="$nodes" mode="toc">
406 <xsl:with-param name="toc-context" select="$toc-context"/>
407 </xsl:apply-templates>
408 </fo:block>
409 </xsl:if>
410</xsl:template>
411
412<xsl:template match="set" mode="toc">
413 <xsl:param name="toc-context" select="."/>
414
415 <xsl:variable name="id">
416 <xsl:call-template name="object.id"/>
417 </xsl:variable>
418
419 <xsl:variable name="cid">
420 <xsl:call-template name="object.id">
421 <xsl:with-param name="object" select="$toc-context"/>
422 </xsl:call-template>
423 </xsl:variable>
424
425 <xsl:call-template name="toc.line">
426 <xsl:with-param name="toc-context" select="$toc-context"/>
427 </xsl:call-template>
428
429 <xsl:variable name="nodes" select="set|book|setindex"/>
430
431 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
432
433 <xsl:if test="$toc.max.depth > $depth.from.context
434 and $nodes">
435 <fo:block id="toc.{$cid}.{$id}">
436 <xsl:attribute name="margin-{$direction.align.start}">
437 <xsl:call-template name="set.toc.indent"/>
438 </xsl:attribute>
439
440 <xsl:apply-templates select="$nodes" mode="toc">
441 <xsl:with-param name="toc-context" select="$toc-context"/>
442 </xsl:apply-templates>
443 </fo:block>
444 </xsl:if>
445</xsl:template>
446
447<xsl:template match="part" mode="toc">
448 <xsl:param name="toc-context" select="."/>
449
450 <xsl:variable name="id">
451 <xsl:call-template name="object.id"/>
452 </xsl:variable>
453
454 <xsl:variable name="cid">
455 <xsl:call-template name="object.id">
456 <xsl:with-param name="object" select="$toc-context"/>
457 </xsl:call-template>
458 </xsl:variable>
459
460 <xsl:call-template name="toc.line">
461 <xsl:with-param name="toc-context" select="$toc-context"/>
462 </xsl:call-template>
463
464 <xsl:variable name="nodes" select="chapter|appendix|preface|reference|
465 refentry|article|topic|index|glossary|
466 bibliography"/>
467
468 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
469
470 <xsl:if test="$toc.max.depth > $depth.from.context
471 and $nodes">
472 <fo:block id="toc.{$cid}.{$id}">
473 <xsl:attribute name="margin-{$direction.align.start}">
474 <xsl:call-template name="set.toc.indent"/>
475 </xsl:attribute>
476
477 <xsl:apply-templates select="$nodes" mode="toc">
478 <xsl:with-param name="toc-context" select="$toc-context"/>
479 </xsl:apply-templates>
480 </fo:block>
481 </xsl:if>
482</xsl:template>
483
484<xsl:template match="reference" mode="toc">
485 <xsl:param name="toc-context" select="."/>
486
487 <xsl:variable name="id">
488 <xsl:call-template name="object.id"/>
489 </xsl:variable>
490
491 <xsl:variable name="cid">
492 <xsl:call-template name="object.id">
493 <xsl:with-param name="object" select="$toc-context"/>
494 </xsl:call-template>
495 </xsl:variable>
496
497 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
498
499 <xsl:call-template name="toc.line">
500 <xsl:with-param name="toc-context" select="$toc-context"/>
501 </xsl:call-template>
502
503 <xsl:if test="$toc.section.depth > 0
504 and $toc.max.depth > $depth.from.context
505 and refentry">
506 <fo:block id="toc.{$cid}.{$id}">
507 <xsl:attribute name="margin-{$direction.align.start}">
508 <xsl:call-template name="set.toc.indent"/>
509 </xsl:attribute>
510
511 <xsl:apply-templates select="refentry" mode="toc">
512 <xsl:with-param name="toc-context" select="$toc-context"/>
513 </xsl:apply-templates>
514 </fo:block>
515 </xsl:if>
516</xsl:template>
517
518<xsl:template match="refentry" mode="toc">
519 <xsl:param name="toc-context" select="."/>
520
521 <xsl:call-template name="toc.line">
522 <xsl:with-param name="toc-context" select="$toc-context"/>
523 </xsl:call-template>
524</xsl:template>
525
526<xsl:template match="preface|chapter|appendix|article"
527 mode="toc">
528 <xsl:param name="toc-context" select="."/>
529
530 <xsl:variable name="id">
531 <xsl:call-template name="object.id"/>
532 </xsl:variable>
533
534 <xsl:variable name="cid">
535 <xsl:call-template name="object.id">
536 <xsl:with-param name="object" select="$toc-context"/>
537 </xsl:call-template>
538 </xsl:variable>
539
540 <xsl:call-template name="toc.line">
541 <xsl:with-param name="toc-context" select="$toc-context"/>
542 </xsl:call-template>
543
544 <xsl:variable name="nodes" select="section|sect1
545 |qandaset[$qanda.in.toc != 0]
546 |simplesect[$simplesect.in.toc != 0]
547 |topic
548 |refentry|appendix"/>
549
550 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
551
552 <xsl:if test="$toc.section.depth > 0
553 and $toc.max.depth > $depth.from.context
554 and $nodes">
555 <fo:block id="toc.{$cid}.{$id}">
556 <xsl:attribute name="margin-{$direction.align.start}">
557 <xsl:call-template name="set.toc.indent"/>
558 </xsl:attribute>
559
560 <xsl:apply-templates select="$nodes" mode="toc">
561 <xsl:with-param name="toc-context" select="$toc-context"/>
562 </xsl:apply-templates>
563 </fo:block>
564 </xsl:if>
565</xsl:template>
566
567<xsl:template match="sect1" mode="toc">
568 <xsl:param name="toc-context" select="."/>
569
570 <xsl:variable name="id">
571 <xsl:call-template name="object.id"/>
572 </xsl:variable>
573
574 <xsl:variable name="cid">
575 <xsl:call-template name="object.id">
576 <xsl:with-param name="object" select="$toc-context"/>
577 </xsl:call-template>
578 </xsl:variable>
579
580 <xsl:call-template name="toc.line">
581 <xsl:with-param name="toc-context" select="$toc-context"/>
582 </xsl:call-template>
583
584 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
585
586 <xsl:if test="$toc.section.depth > 1
587 and $toc.max.depth > $depth.from.context
588 and sect2">
589 <fo:block id="toc.{$cid}.{$id}">
590 <xsl:attribute name="margin-{$direction.align.start}">
591 <xsl:call-template name="set.toc.indent"/>
592 </xsl:attribute>
593
594 <xsl:apply-templates select="sect2|qandaset[$qanda.in.toc != 0]"
595 mode="toc">
596 <xsl:with-param name="toc-context" select="$toc-context"/>
597 </xsl:apply-templates>
598 </fo:block>
599 </xsl:if>
600</xsl:template>
601
602<xsl:template match="sect2" mode="toc">
603 <xsl:param name="toc-context" select="."/>
604
605 <xsl:variable name="id">
606 <xsl:call-template name="object.id"/>
607 </xsl:variable>
608
609 <xsl:variable name="cid">
610 <xsl:call-template name="object.id">
611 <xsl:with-param name="object" select="$toc-context"/>
612 </xsl:call-template>
613 </xsl:variable>
614
615 <xsl:call-template name="toc.line">
616 <xsl:with-param name="toc-context" select="$toc-context"/>
617 </xsl:call-template>
618
619 <xsl:variable name="reldepth"
620 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
621
622 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
623
624 <xsl:if test="$toc.section.depth > 2
625 and $toc.max.depth > $depth.from.context
626 and sect3">
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"/>
631 </xsl:call-template>
632 </xsl:attribute>
633
634 <xsl:apply-templates select="sect3|qandaset[$qanda.in.toc != 0]"
635 mode="toc">
636 <xsl:with-param name="toc-context" select="$toc-context"/>
637 </xsl:apply-templates>
638 </fo:block>
639 </xsl:if>
640</xsl:template>
641
642<xsl:template match="sect3" mode="toc">
643 <xsl:param name="toc-context" select="."/>
644
645 <xsl:variable name="id">
646 <xsl:call-template name="object.id"/>
647 </xsl:variable>
648
649 <xsl:variable name="cid">
650 <xsl:call-template name="object.id">
651 <xsl:with-param name="object" select="$toc-context"/>
652 </xsl:call-template>
653 </xsl:variable>
654
655 <xsl:call-template name="toc.line">
656 <xsl:with-param name="toc-context" select="$toc-context"/>
657 </xsl:call-template>
658
659 <xsl:variable name="reldepth"
660 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
661
662 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
663
664 <xsl:if test="$toc.section.depth > 3
665 and $toc.max.depth > $depth.from.context
666 and sect4">
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"/>
671 </xsl:call-template>
672 </xsl:attribute>
673
674 <xsl:apply-templates select="sect4|qandaset[$qanda.in.toc != 0]"
675 mode="toc">
676 <xsl:with-param name="toc-context" select="$toc-context"/>
677 </xsl:apply-templates>
678 </fo:block>
679 </xsl:if>
680</xsl:template>
681
682<xsl:template match="sect4" mode="toc">
683 <xsl:param name="toc-context" select="."/>
684
685 <xsl:variable name="id">
686 <xsl:call-template name="object.id"/>
687 </xsl:variable>
688
689 <xsl:variable name="cid">
690 <xsl:call-template name="object.id">
691 <xsl:with-param name="object" select="$toc-context"/>
692 </xsl:call-template>
693 </xsl:variable>
694
695 <xsl:call-template name="toc.line">
696 <xsl:with-param name="toc-context" select="$toc-context"/>
697 </xsl:call-template>
698
699 <xsl:variable name="reldepth"
700 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
701
702 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
703
704 <xsl:if test="$toc.section.depth > 4
705 and $toc.max.depth > $depth.from.context
706 and sect5">
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"/>
711 </xsl:call-template>
712 </xsl:attribute>
713
714 <xsl:apply-templates select="sect5|qandaset[$qanda.in.toc != 0]"
715 mode="toc">
716 <xsl:with-param name="toc-context" select="$toc-context"/>
717 </xsl:apply-templates>
718 </fo:block>
719 </xsl:if>
720</xsl:template>
721
722<xsl:template match="sect5|simplesect" mode="toc">
723 <xsl:param name="toc-context" select="."/>
724
725 <xsl:call-template name="toc.line">
726 <xsl:with-param name="toc-context" select="$toc-context"/>
727 </xsl:call-template>
728</xsl:template>
729
730<xsl:template match="topic" mode="toc">
731 <xsl:param name="toc-context" select="."/>
732
733 <xsl:call-template name="toc.line">
734 <xsl:with-param name="toc-context" select="$toc-context"/>
735 </xsl:call-template>
736</xsl:template>
737
738<xsl:template name="set.toc.indent">
739 <xsl:param name="reldepth"/>
740
741 <xsl:variable name="depth">
742 <xsl:choose>
743 <xsl:when test="$reldepth != ''">
744 <xsl:value-of select="$reldepth"/>
745 </xsl:when>
746 <xsl:otherwise>
747 <xsl:value-of select="count(ancestor::*)"/>
748 </xsl:otherwise>
749 </xsl:choose>
750 </xsl:variable>
751
752 <xsl:choose>
753 <xsl:when test="$fop.extensions != 0">
754 <xsl:value-of select="concat($depth*$toc.indent.width, 'pt')"/>
755 </xsl:when>
756 <xsl:otherwise>
757 <xsl:value-of select="concat($toc.indent.width, 'pt')"/>
758 </xsl:otherwise>
759 </xsl:choose>
760</xsl:template>
761
762
763<xsl:template match="section" mode="toc">
764 <xsl:param name="toc-context" select="."/>
765
766 <xsl:variable name="id">
767 <xsl:call-template name="object.id"/>
768 </xsl:variable>
769
770 <xsl:variable name="cid">
771 <xsl:call-template name="object.id">
772 <xsl:with-param name="object" select="$toc-context"/>
773 </xsl:call-template>
774 </xsl:variable>
775
776 <xsl:variable name="depth" select="count(ancestor::section) + 1"/>
777 <xsl:variable name="reldepth"
778 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
779
780 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
781
782 <xsl:if test="$toc.section.depth &gt;= $depth">
783 <xsl:call-template name="toc.line">
784 <xsl:with-param name="toc-context" select="$toc-context"/>
785 </xsl:call-template>
786
787 <xsl:if test="$toc.section.depth > $depth
788 and $toc.max.depth > $depth.from.context
789 and section">
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"/>
794 </xsl:call-template>
795 </xsl:attribute>
796
797 <xsl:apply-templates select="section|qandaset[$qanda.in.toc != 0]"
798 mode="toc">
799 <xsl:with-param name="toc-context" select="$toc-context"/>
800 </xsl:apply-templates>
801 </fo:block>
802 </xsl:if>
803 </xsl:if>
804</xsl:template>
805
806<xsl:template match="bibliography|glossary"
807 mode="toc">
808 <xsl:param name="toc-context" select="."/>
809
810 <xsl:call-template name="toc.line">
811 <xsl:with-param name="toc-context" select="$toc-context"/>
812 </xsl:call-template>
813</xsl:template>
814
815<xsl:template match="index" mode="toc">
816 <xsl:param name="toc-context" select="."/>
817
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"/>
821 </xsl:call-template>
822 </xsl:if>
823</xsl:template>
824
825<xsl:template match="title" mode="toc">
826 <xsl:apply-templates/>
827</xsl:template>
828
829<!-- ==================================================================== -->
830
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="."/>
835
836 <xsl:variable name="id">
837 <xsl:call-template name="object.id"/>
838 </xsl:variable>
839
840 <xsl:if test="$nodes">
841 <fo:block id="lot...{$titles}...{$id}">
842 <xsl:choose>
843 <xsl:when test="$titles='table'">
844 <xsl:call-template name="list.of.tables.titlepage"/>
845 </xsl:when>
846 <xsl:when test="$titles='figure'">
847 <xsl:call-template name="list.of.figures.titlepage"/>
848 </xsl:when>
849 <xsl:when test="$titles='equation'">
850 <xsl:call-template name="list.of.equations.titlepage"/>
851 </xsl:when>
852 <xsl:when test="$titles='example'">
853 <xsl:call-template name="list.of.examples.titlepage"/>
854 </xsl:when>
855 <xsl:when test="$titles='procedure'">
856 <xsl:call-template name="list.of.procedures.titlepage"/>
857 </xsl:when>
858 <xsl:otherwise>
859 <xsl:call-template name="list.of.unknowns.titlepage"/>
860 </xsl:otherwise>
861 </xsl:choose>
862 <xsl:apply-templates select="$nodes" mode="toc">
863 <xsl:with-param name="toc-context" select="$toc-context"/>
864 </xsl:apply-templates>
865 </fo:block>
866 </xsl:if>
867</xsl:template>
868
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="."/>
873
874 <xsl:variable name="id">
875 <xsl:call-template name="object.id"/>
876 </xsl:variable>
877
878 <xsl:if test="$nodes">
879 <fo:block id="lot...{$titles}...{$id}">
880 <xsl:choose>
881 <xsl:when test="$titles='table'">
882 <xsl:call-template name="component.list.of.tables.titlepage"/>
883 </xsl:when>
884 <xsl:when test="$titles='figure'">
885 <xsl:call-template name="component.list.of.figures.titlepage"/>
886 </xsl:when>
887 <xsl:when test="$titles='equation'">
888 <xsl:call-template name="component.list.of.equations.titlepage"/>
889 </xsl:when>
890 <xsl:when test="$titles='example'">
891 <xsl:call-template name="component.list.of.examples.titlepage"/>
892 </xsl:when>
893 <xsl:when test="$titles='procedure'">
894 <xsl:call-template name="component.list.of.procedures.titlepage"/>
895 </xsl:when>
896 <xsl:otherwise>
897 <xsl:call-template name="component.list.of.unknowns.titlepage"/>
898 </xsl:otherwise>
899 </xsl:choose>
900 <xsl:apply-templates select="$nodes" mode="toc">
901 <xsl:with-param name="toc-context" select="$toc-context"/>
902 </xsl:apply-templates>
903 </fo:block>
904 </xsl:if>
905</xsl:template>
906
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"/>
911 </xsl:call-template>
912</xsl:template>
913
914<!-- ==================================================================== -->
915
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="."/>
919
920 <xsl:variable name="id">
921 <xsl:call-template name="object.id"/>
922 </xsl:variable>
923
924 <xsl:variable name="cid">
925 <xsl:call-template name="object.id">
926 <xsl:with-param name="object" select="$toc-context"/>
927 </xsl:call-template>
928 </xsl:variable>
929
930 <xsl:variable name="depth" select="count(ancestor::section) + 1"/>
931 <xsl:variable name="reldepth"
932 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
933
934 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
935
936 <xsl:if test="$toc.section.depth &gt;= $depth">
937 <xsl:call-template name="toc.line">
938 <xsl:with-param name="toc-context" select="$toc-context"/>
939 </xsl:call-template>
940
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"/>
948 </xsl:call-template>
949 </xsl:attribute>
950
951 <xsl:apply-templates select="qandadiv|qandaentry" mode="toc">
952 <xsl:with-param name="toc-context" select="$toc-context"/>
953 </xsl:apply-templates>
954 </fo:block>
955 </xsl:if>
956 </xsl:if>
957</xsl:template>
958
959</xsl:stylesheet>
960
Note: See TracBrowser for help on using the repository browser.