source: BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/fo/autotoc.xsl@ 37da1a9

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 37da1a9 was f8c4e94, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added LFS XSL Stylesheets.

  • Property mode set to 100644
File size: 27.7 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$
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 <xsl:param name="toc-context" select="."/>
21
22 <xsl:variable name="id">
23 <xsl:call-template name="object.id"/>
24 </xsl:variable>
25
26 <xsl:variable name="cid">
27 <xsl:call-template name="object.id">
28 <xsl:with-param name="object" select="$toc-context"/>
29 </xsl:call-template>
30 </xsl:variable>
31
32 <xsl:variable name="nodes" select="book|setindex"/>
33
34 <xsl:if test="$nodes">
35 <fo:block id="toc...{$id}"
36 xsl:use-attribute-sets="toc.margin.properties">
37 <xsl:if test="$axf.extensions != 0">
38 <xsl:attribute name="axf:outline-level">1</xsl:attribute>
39 <xsl:attribute name="axf:outline-expand">false</xsl:attribute>
40 <xsl:attribute name="axf:outline-title">
41 <xsl:call-template name="gentext">
42 <xsl:with-param name="key" select="'TableofContents'"/>
43 </xsl:call-template>
44 </xsl:attribute>
45 </xsl:if>
46 <xsl:call-template name="table.of.contents.titlepage"/>
47 <xsl:apply-templates select="$nodes" mode="toc">
48 <xsl:with-param name="toc-context" select="$toc-context"/>
49 </xsl:apply-templates>
50 </fo:block>
51 </xsl:if>
52</xsl:template>
53
54<xsl:template name="division.toc">
55 <xsl:param name="toc-context" select="."/>
56 <xsl:param name="toc.title.p" select="true()"/>
57
58 <xsl:variable name="cid">
59 <xsl:call-template name="object.id">
60 <xsl:with-param name="object" select="$toc-context"/>
61 </xsl:call-template>
62 </xsl:variable>
63
64 <xsl:variable name="nodes"
65 select="$toc-context/part
66 |$toc-context/reference
67 |$toc-context/preface
68 |$toc-context/chapter
69 |$toc-context/appendix
70 |$toc-context/article
71 |$toc-context/bibliography
72 |$toc-context/glossary
73 |$toc-context/index"/>
74
75 <xsl:if test="$nodes">
76 <fo:block id="toc...{$cid}"
77 xsl:use-attribute-sets="toc.margin.properties">
78 <xsl:if test="$axf.extensions != 0">
79 <xsl:attribute name="axf:outline-level">1</xsl:attribute>
80 <xsl:attribute name="axf:outline-expand">false</xsl:attribute>
81 <xsl:attribute name="axf:outline-title">
82 <xsl:call-template name="gentext">
83 <xsl:with-param name="key" select="'TableofContents'"/>
84 </xsl:call-template>
85 </xsl:attribute>
86 </xsl:if>
87 <xsl:if test="$toc.title.p">
88 <xsl:call-template name="table.of.contents.titlepage"/>
89 </xsl:if>
90 <xsl:apply-templates select="$nodes" mode="toc">
91 <xsl:with-param name="toc-context" select="$toc-context"/>
92 </xsl:apply-templates>
93 </fo:block>
94 </xsl:if>
95</xsl:template>
96
97<xsl:template name="component.toc">
98 <xsl:param name="toc-context" select="."/>
99 <xsl:param name="toc.title.p" select="true()"/>
100
101 <xsl:variable name="id">
102 <xsl:call-template name="object.id"/>
103 </xsl:variable>
104
105 <xsl:variable name="cid">
106 <xsl:call-template name="object.id">
107 <xsl:with-param name="object" select="$toc-context"/>
108 </xsl:call-template>
109 </xsl:variable>
110
111 <xsl:variable name="nodes" select="section|sect1|refentry
112 |article|bibliography|glossary
113 |qandaset[$qanda.in.toc != 0]
114 |appendix|index"/>
115 <xsl:if test="$nodes">
116 <fo:block id="toc...{$id}"
117 xsl:use-attribute-sets="toc.margin.properties">
118 <xsl:if test="$toc.title.p">
119 <xsl:call-template name="table.of.contents.titlepage"/>
120 </xsl:if>
121 <xsl:apply-templates select="$nodes" mode="toc">
122 <xsl:with-param name="toc-context" select="$toc-context"/>
123 </xsl:apply-templates>
124 </fo:block>
125 </xsl:if>
126</xsl:template>
127
128<xsl:template name="component.toc.separator">
129 <!-- Customize to output something between
130 component.toc and first output -->
131</xsl:template>
132
133<xsl:template name="section.toc">
134 <xsl:param name="toc-context" select="."/>
135 <xsl:param name="toc.title.p" select="true()"/>
136
137 <xsl:variable name="id">
138 <xsl:call-template name="object.id"/>
139 </xsl:variable>
140
141 <xsl:variable name="cid">
142 <xsl:call-template name="object.id">
143 <xsl:with-param name="object" select="$toc-context"/>
144 </xsl:call-template>
145 </xsl:variable>
146
147 <xsl:variable name="nodes"
148 select="section|sect1|sect2|sect3|sect4|sect5|refentry
149 |qandaset[$qanda.in.toc != 0]
150 |bridgehead[$bridgehead.in.toc != 0]"/>
151
152 <xsl:variable name="level">
153 <xsl:call-template name="section.level"/>
154 </xsl:variable>
155
156 <xsl:if test="$nodes">
157 <fo:block id="toc...{$id}"
158 xsl:use-attribute-sets="toc.margin.properties">
159
160 <xsl:if test="$toc.title.p">
161 <xsl:call-template name="section.heading">
162 <xsl:with-param name="level" select="$level + 1"/>
163 <xsl:with-param name="title">
164 <fo:block space-after="0.5em">
165 <xsl:call-template name="gentext">
166 <xsl:with-param name="key" select="'TableofContents'"/>
167 </xsl:call-template>
168 </fo:block>
169 </xsl:with-param>
170 </xsl:call-template>
171 </xsl:if>
172
173 <xsl:apply-templates select="$nodes" mode="toc">
174 <xsl:with-param name="toc-context" select="$toc-context"/>
175 </xsl:apply-templates>
176 </fo:block>
177 </xsl:if>
178</xsl:template>
179
180<xsl:template name="section.toc.separator">
181 <!-- Customize to output something between
182 section.toc and first output -->
183</xsl:template>
184<!-- ==================================================================== -->
185
186<xsl:template name="toc.line">
187 <xsl:param name="toc-context" select="NOTANODE"/>
188
189 <xsl:variable name="id">
190 <xsl:call-template name="object.id"/>
191 </xsl:variable>
192
193 <xsl:variable name="label">
194 <xsl:apply-templates select="." mode="label.markup"/>
195 </xsl:variable>
196
197 <fo:block xsl:use-attribute-sets="toc.line.properties">
198 <fo:inline keep-with-next.within-line="always">
199 <fo:basic-link internal-destination="{$id}">
200 <xsl:if test="$label != ''">
201 <xsl:copy-of select="$label"/>
202 <xsl:value-of select="$autotoc.label.separator"/>
203 </xsl:if>
204 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
205 </fo:basic-link>
206 </fo:inline>
207 <fo:inline keep-together.within-line="always">
208 <xsl:text> </xsl:text>
209 <fo:leader leader-pattern="dots"
210 leader-pattern-width="3pt"
211 leader-alignment="reference-area"
212 keep-with-next.within-line="always"/>
213 <xsl:text> </xsl:text>
214 <fo:basic-link internal-destination="{$id}">
215 <fo:page-number-citation ref-id="{$id}"/>
216 </fo:basic-link>
217 </fo:inline>
218 </fo:block>
219</xsl:template>
220
221<!-- ==================================================================== -->
222<xsl:template name="qandaset.toc">
223 <xsl:param name="toc-context" select="."/>
224 <xsl:param name="toc.title.p" select="true()"/>
225
226 <xsl:variable name="id">
227 <xsl:call-template name="object.id"/>
228 </xsl:variable>
229
230 <xsl:variable name="cid">
231 <xsl:call-template name="object.id">
232 <xsl:with-param name="object" select="$toc-context"/>
233 </xsl:call-template>
234 </xsl:variable>
235
236 <xsl:variable name="nodes" select="qandadiv|qandaentry"/>
237
238 <xsl:if test="$nodes">
239 <fo:block id="toc...{$id}"
240 xsl:use-attribute-sets="toc.margin.properties">
241 <xsl:if test="$toc.title.p">
242 <xsl:call-template name="table.of.contents.titlepage"/>
243 </xsl:if>
244 <xsl:apply-templates select="$nodes" mode="toc">
245 <xsl:with-param name="toc-context" select="$toc-context"/>
246 </xsl:apply-templates>
247 </fo:block>
248 </xsl:if>
249</xsl:template>
250
251<xsl:template name="qandaset.toc.separator">
252 <!-- Customize to output something between
253 qandaset.toc and first output -->
254</xsl:template>
255
256<xsl:template match="qandadiv" mode="toc">
257 <xsl:param name="toc-context" select="."/>
258
259 <xsl:variable name="id">
260 <xsl:call-template name="object.id"/>
261 </xsl:variable>
262
263 <xsl:variable name="cid">
264 <xsl:call-template name="object.id">
265 <xsl:with-param name="object" select="$toc-context"/>
266 </xsl:call-template>
267 </xsl:variable>
268
269 <xsl:call-template name="toc.line">
270 <xsl:with-param name="toc-context" select="$toc-context"/>
271 </xsl:call-template>
272
273 <xsl:variable name="nodes" select="qandadiv|qandaentry"/>
274
275 <xsl:if test="$nodes">
276 <fo:block id="toc.{$cid}.{$id}">
277 <xsl:attribute name="margin-left">
278 <xsl:call-template name="set.toc.indent"/>
279 </xsl:attribute>
280
281 <xsl:apply-templates select="$nodes" mode="toc">
282 <xsl:with-param name="toc-context" select="$toc-context"/>
283 </xsl:apply-templates>
284 </fo:block>
285 </xsl:if>
286</xsl:template>
287
288<xsl:template match="qandaentry" mode="toc">
289 <xsl:apply-templates select="question" mode="toc"/>
290</xsl:template>
291
292<xsl:template match="question" mode="toc">
293 <xsl:variable name="firstchunk">
294 <xsl:apply-templates select="(*[local-name(.)!='label'])[1]/node()"/>
295 </xsl:variable>
296
297 <xsl:variable name="deflabel">
298 <xsl:choose>
299 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
300 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
301 /@defaultlabel"/>
302 </xsl:when>
303 <xsl:otherwise>
304 <xsl:value-of select="$qanda.defaultlabel"/>
305 </xsl:otherwise>
306 </xsl:choose>
307 </xsl:variable>
308
309 <xsl:variable name="id">
310 <xsl:call-template name="object.id"/>
311 </xsl:variable>
312
313 <xsl:variable name="label">
314 <xsl:apply-templates select="." mode="label.markup"/>
315 </xsl:variable>
316
317 <fo:block xsl:use-attribute-sets="toc.line.properties"
318 margin-left="3em"
319 text-indent="-3em"
320 end-indent="{$toc.indent.width}pt"
321 last-line-end-indent="-{$toc.indent.width}pt">
322 <fo:inline keep-with-next.within-line="always">
323 <fo:basic-link internal-destination="{$id}">
324 <xsl:if test="$label != ''">
325 <xsl:copy-of select="$label"/>
326 <xsl:if test="$deflabel = 'number' and not(label)">
327 <xsl:value-of select="$autotoc.label.separator"/>
328 </xsl:if>
329 <xsl:text> </xsl:text>
330 </xsl:if>
331 <xsl:copy-of select="$firstchunk"/>
332 </fo:basic-link>
333 </fo:inline>
334 <fo:inline keep-together.within-line="always">
335 <xsl:text> </xsl:text>
336 <fo:leader leader-pattern="dots"
337 leader-pattern-width="3pt"
338 leader-alignment="reference-area"
339 keep-with-next.within-line="always"/>
340 <xsl:text> </xsl:text>
341 <fo:basic-link internal-destination="{$id}">
342 <fo:page-number-citation ref-id="{$id}"/>
343 </fo:basic-link>
344 </fo:inline>
345 </fo:block>
346
347</xsl:template>
348
349<!-- ==================================================================== -->
350
351<xsl:template match="book|setindex" mode="toc">
352 <xsl:param name="toc-context" select="."/>
353
354 <xsl:variable name="id">
355 <xsl:call-template name="object.id"/>
356 </xsl:variable>
357
358 <xsl:variable name="cid">
359 <xsl:call-template name="object.id">
360 <xsl:with-param name="object" select="$toc-context"/>
361 </xsl:call-template>
362 </xsl:variable>
363
364 <xsl:call-template name="toc.line">
365 <xsl:with-param name="toc-context" select="$toc-context"/>
366 </xsl:call-template>
367
368 <xsl:variable name="nodes" select="glossary|bibliography|preface|chapter
369 |reference|part|article|appendix|index"/>
370
371 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
372
373 <xsl:if test="$toc.section.depth > 0
374 and $toc.max.depth > $depth.from.context
375 and $nodes">
376 <fo:block id="toc.{$cid}.{$id}">
377 <xsl:attribute name="margin-left">
378 <xsl:call-template name="set.toc.indent"/>
379 </xsl:attribute>
380
381 <xsl:apply-templates select="$nodes" mode="toc">
382 <xsl:with-param name="toc-context" select="$toc-context"/>
383 </xsl:apply-templates>
384 </fo:block>
385 </xsl:if>
386</xsl:template>
387
388<xsl:template match="part" mode="toc">
389 <xsl:param name="toc-context" select="."/>
390
391 <xsl:variable name="id">
392 <xsl:call-template name="object.id"/>
393 </xsl:variable>
394
395 <xsl:variable name="cid">
396 <xsl:call-template name="object.id">
397 <xsl:with-param name="object" select="$toc-context"/>
398 </xsl:call-template>
399 </xsl:variable>
400
401 <xsl:call-template name="toc.line">
402 <xsl:with-param name="toc-context" select="$toc-context"/>
403 </xsl:call-template>
404
405 <xsl:variable name="nodes" select="chapter|appendix|preface|reference|
406 refentry|article|index|glossary|
407 bibliography"/>
408
409 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
410
411 <xsl:if test="$toc.section.depth > 0
412 and $toc.max.depth > $depth.from.context
413 and $nodes">
414 <fo:block id="toc.{$cid}.{$id}">
415 <xsl:attribute name="margin-left">
416 <xsl:call-template name="set.toc.indent"/>
417 </xsl:attribute>
418
419 <xsl:apply-templates select="$nodes" mode="toc">
420 <xsl:with-param name="toc-context" select="$toc-context"/>
421 </xsl:apply-templates>
422 </fo:block>
423 </xsl:if>
424</xsl:template>
425
426<xsl:template match="reference" mode="toc">
427 <xsl:param name="toc-context" select="."/>
428
429 <xsl:variable name="id">
430 <xsl:call-template name="object.id"/>
431 </xsl:variable>
432
433 <xsl:variable name="cid">
434 <xsl:call-template name="object.id">
435 <xsl:with-param name="object" select="$toc-context"/>
436 </xsl:call-template>
437 </xsl:variable>
438
439 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
440
441 <xsl:call-template name="toc.line">
442 <xsl:with-param name="toc-context" select="$toc-context"/>
443 </xsl:call-template>
444
445 <xsl:if test="$toc.section.depth > 0
446 and $toc.max.depth > $depth.from.context
447 and refentry">
448 <fo:block id="toc.{$cid}.{$id}">
449 <xsl:attribute name="margin-left">
450 <xsl:call-template name="set.toc.indent"/>
451 </xsl:attribute>
452
453 <xsl:apply-templates select="refentry" mode="toc">
454 <xsl:with-param name="toc-context" select="$toc-context"/>
455 </xsl:apply-templates>
456 </fo:block>
457 </xsl:if>
458</xsl:template>
459
460<xsl:template match="refentry" mode="toc">
461 <xsl:param name="toc-context" select="."/>
462
463 <xsl:call-template name="toc.line">
464 <xsl:with-param name="toc-context" select="$toc-context"/>
465 </xsl:call-template>
466</xsl:template>
467
468<xsl:template match="preface|chapter|appendix|article"
469 mode="toc">
470 <xsl:param name="toc-context" select="."/>
471
472 <xsl:variable name="id">
473 <xsl:call-template name="object.id"/>
474 </xsl:variable>
475
476 <xsl:variable name="cid">
477 <xsl:call-template name="object.id">
478 <xsl:with-param name="object" select="$toc-context"/>
479 </xsl:call-template>
480 </xsl:variable>
481
482 <xsl:call-template name="toc.line">
483 <xsl:with-param name="toc-context" select="$toc-context"/>
484 </xsl:call-template>
485
486 <xsl:variable name="nodes" select="section|sect1
487 |qandaset[$qanda.in.toc != 0]
488 |simplesect[$simplesect.in.toc != 0]
489 |refentry|appendix"/>
490
491 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
492
493 <xsl:if test="$toc.section.depth > 0
494 and $toc.max.depth > $depth.from.context
495 and $nodes">
496 <fo:block id="toc.{$cid}.{$id}">
497 <xsl:attribute name="margin-left">
498 <xsl:call-template name="set.toc.indent"/>
499 </xsl:attribute>
500
501 <xsl:apply-templates select="$nodes" mode="toc">
502 <xsl:with-param name="toc-context" select="$toc-context"/>
503 </xsl:apply-templates>
504 </fo:block>
505 </xsl:if>
506</xsl:template>
507
508<xsl:template match="sect1" mode="toc">
509 <xsl:param name="toc-context" select="."/>
510
511 <xsl:variable name="id">
512 <xsl:call-template name="object.id"/>
513 </xsl:variable>
514
515 <xsl:variable name="cid">
516 <xsl:call-template name="object.id">
517 <xsl:with-param name="object" select="$toc-context"/>
518 </xsl:call-template>
519 </xsl:variable>
520
521 <xsl:call-template name="toc.line">
522 <xsl:with-param name="toc-context" select="$toc-context"/>
523 </xsl:call-template>
524
525 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
526
527 <xsl:if test="$toc.section.depth > 1
528 and $toc.max.depth > $depth.from.context
529 and sect2">
530 <fo:block id="toc.{$cid}.{$id}">
531 <xsl:attribute name="margin-left">
532 <xsl:call-template name="set.toc.indent"/>
533 </xsl:attribute>
534
535 <xsl:apply-templates select="sect2|qandaset[$qanda.in.toc != 0]"
536 mode="toc">
537 <xsl:with-param name="toc-context" select="$toc-context"/>
538 </xsl:apply-templates>
539 </fo:block>
540 </xsl:if>
541</xsl:template>
542
543<xsl:template match="sect2" mode="toc">
544 <xsl:param name="toc-context" select="."/>
545
546 <xsl:variable name="id">
547 <xsl:call-template name="object.id"/>
548 </xsl:variable>
549
550 <xsl:variable name="cid">
551 <xsl:call-template name="object.id">
552 <xsl:with-param name="object" select="$toc-context"/>
553 </xsl:call-template>
554 </xsl:variable>
555
556 <xsl:call-template name="toc.line">
557 <xsl:with-param name="toc-context" select="$toc-context"/>
558 </xsl:call-template>
559
560 <xsl:variable name="reldepth"
561 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
562
563 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
564
565 <xsl:if test="$toc.section.depth > 2
566 and $toc.max.depth > $depth.from.context
567 and sect3">
568 <fo:block id="toc.{$cid}.{$id}">
569 <xsl:attribute name="margin-left">
570 <xsl:call-template name="set.toc.indent">
571 <xsl:with-param name="reldepth" select="$reldepth"/>
572 </xsl:call-template>
573 </xsl:attribute>
574
575 <xsl:apply-templates select="sect3|qandaset[$qanda.in.toc != 0]"
576 mode="toc">
577 <xsl:with-param name="toc-context" select="$toc-context"/>
578 </xsl:apply-templates>
579 </fo:block>
580 </xsl:if>
581</xsl:template>
582
583<xsl:template match="sect3" mode="toc">
584 <xsl:param name="toc-context" select="."/>
585
586 <xsl:variable name="id">
587 <xsl:call-template name="object.id"/>
588 </xsl:variable>
589
590 <xsl:variable name="cid">
591 <xsl:call-template name="object.id">
592 <xsl:with-param name="object" select="$toc-context"/>
593 </xsl:call-template>
594 </xsl:variable>
595
596 <xsl:call-template name="toc.line">
597 <xsl:with-param name="toc-context" select="$toc-context"/>
598 </xsl:call-template>
599
600 <xsl:variable name="reldepth"
601 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
602
603 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
604
605 <xsl:if test="$toc.section.depth > 3
606 and $toc.max.depth > $depth.from.context
607 and sect4">
608 <fo:block id="toc.{$cid}.{$id}">
609 <xsl:attribute name="margin-left">
610 <xsl:call-template name="set.toc.indent">
611 <xsl:with-param name="reldepth" select="$reldepth"/>
612 </xsl:call-template>
613 </xsl:attribute>
614
615 <xsl:apply-templates select="sect4|qandaset[$qanda.in.toc != 0]"
616 mode="toc">
617 <xsl:with-param name="toc-context" select="$toc-context"/>
618 </xsl:apply-templates>
619 </fo:block>
620 </xsl:if>
621</xsl:template>
622
623<xsl:template match="sect4" mode="toc">
624 <xsl:param name="toc-context" select="."/>
625
626 <xsl:variable name="id">
627 <xsl:call-template name="object.id"/>
628 </xsl:variable>
629
630 <xsl:variable name="cid">
631 <xsl:call-template name="object.id">
632 <xsl:with-param name="object" select="$toc-context"/>
633 </xsl:call-template>
634 </xsl:variable>
635
636 <xsl:call-template name="toc.line">
637 <xsl:with-param name="toc-context" select="$toc-context"/>
638 </xsl:call-template>
639
640 <xsl:variable name="reldepth"
641 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
642
643 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
644
645 <xsl:if test="$toc.section.depth > 4
646 and $toc.max.depth > $depth.from.context
647 and sect5">
648 <fo:block id="toc.{$cid}.{$id}">
649 <xsl:attribute name="margin-left">
650 <xsl:call-template name="set.toc.indent">
651 <xsl:with-param name="reldepth" select="$reldepth"/>
652 </xsl:call-template>
653 </xsl:attribute>
654
655 <xsl:apply-templates select="sect5|qandaset[$qanda.in.toc != 0]"
656 mode="toc">
657 <xsl:with-param name="toc-context" select="$toc-context"/>
658 </xsl:apply-templates>
659 </fo:block>
660 </xsl:if>
661</xsl:template>
662
663<xsl:template match="sect5|simplesect" mode="toc">
664 <xsl:param name="toc-context" select="."/>
665
666 <xsl:call-template name="toc.line">
667 <xsl:with-param name="toc-context" select="$toc-context"/>
668 </xsl:call-template>
669</xsl:template>
670
671<xsl:template name="set.toc.indent">
672 <xsl:param name="reldepth"/>
673
674 <xsl:variable name="depth">
675 <xsl:choose>
676 <xsl:when test="$reldepth != ''">
677 <xsl:value-of select="$reldepth"/>
678 </xsl:when>
679 <xsl:otherwise>
680 <xsl:value-of select="count(ancestor::*)"/>
681 </xsl:otherwise>
682 </xsl:choose>
683 </xsl:variable>
684
685 <xsl:choose>
686 <xsl:when test="$fop.extensions != 0 or $passivetex.extensions != 0">
687 <xsl:value-of select="concat($depth*$toc.indent.width, 'pt')"/>
688 </xsl:when>
689 <xsl:otherwise>
690 <xsl:value-of select="concat($toc.indent.width, 'pt')"/>
691 </xsl:otherwise>
692 </xsl:choose>
693</xsl:template>
694
695
696<xsl:template match="section" mode="toc">
697 <xsl:param name="toc-context" select="."/>
698
699 <xsl:variable name="id">
700 <xsl:call-template name="object.id"/>
701 </xsl:variable>
702
703 <xsl:variable name="cid">
704 <xsl:call-template name="object.id">
705 <xsl:with-param name="object" select="$toc-context"/>
706 </xsl:call-template>
707 </xsl:variable>
708
709 <xsl:variable name="depth" select="count(ancestor::section) + 1"/>
710 <xsl:variable name="reldepth"
711 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
712
713 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
714
715 <xsl:if test="$toc.section.depth &gt;= $depth">
716 <xsl:call-template name="toc.line">
717 <xsl:with-param name="toc-context" select="$toc-context"/>
718 </xsl:call-template>
719
720 <xsl:if test="$toc.section.depth > $depth
721 and $toc.max.depth > $depth.from.context
722 and section">
723 <fo:block id="toc.{$cid}.{$id}">
724 <xsl:attribute name="margin-left">
725 <xsl:call-template name="set.toc.indent">
726 <xsl:with-param name="reldepth" select="$reldepth"/>
727 </xsl:call-template>
728 </xsl:attribute>
729
730 <xsl:apply-templates select="section|qandaset[$qanda.in.toc != 0]"
731 mode="toc">
732 <xsl:with-param name="toc-context" select="$toc-context"/>
733 </xsl:apply-templates>
734 </fo:block>
735 </xsl:if>
736 </xsl:if>
737</xsl:template>
738
739<xsl:template match="bibliography|glossary"
740 mode="toc">
741 <xsl:param name="toc-context" select="."/>
742
743 <xsl:call-template name="toc.line">
744 <xsl:with-param name="toc-context" select="$toc-context"/>
745 </xsl:call-template>
746</xsl:template>
747
748<xsl:template match="index" mode="toc">
749 <xsl:param name="toc-context" select="."/>
750
751 <xsl:if test="* or $generate.index != 0">
752 <xsl:call-template name="toc.line">
753 <xsl:with-param name="toc-context" select="$toc-context"/>
754 </xsl:call-template>
755 </xsl:if>
756</xsl:template>
757
758<xsl:template match="title" mode="toc">
759 <xsl:apply-templates/>
760</xsl:template>
761
762<!-- ==================================================================== -->
763
764<xsl:template name="list.of.titles">
765 <xsl:param name="titles" select="'table'"/>
766 <xsl:param name="nodes" select=".//table"/>
767 <xsl:param name="toc-context" select="."/>
768
769 <xsl:variable name="id">
770 <xsl:call-template name="object.id"/>
771 </xsl:variable>
772
773 <xsl:if test="$nodes">
774 <fo:block id="lot...{$titles}...{$id}">
775 <xsl:choose>
776 <xsl:when test="$titles='table'">
777 <xsl:call-template name="list.of.tables.titlepage"/>
778 </xsl:when>
779 <xsl:when test="$titles='figure'">
780 <xsl:call-template name="list.of.figures.titlepage"/>
781 </xsl:when>
782 <xsl:when test="$titles='equation'">
783 <xsl:call-template name="list.of.equations.titlepage"/>
784 </xsl:when>
785 <xsl:when test="$titles='example'">
786 <xsl:call-template name="list.of.examples.titlepage"/>
787 </xsl:when>
788 <xsl:when test="$titles='procedure'">
789 <xsl:call-template name="list.of.procedures.titlepage"/>
790 </xsl:when>
791 <xsl:otherwise>
792 <xsl:call-template name="list.of.unknowns.titlepage"/>
793 </xsl:otherwise>
794 </xsl:choose>
795 <xsl:apply-templates select="$nodes" mode="toc">
796 <xsl:with-param name="toc-context" select="$toc-context"/>
797 </xsl:apply-templates>
798 </fo:block>
799 </xsl:if>
800</xsl:template>
801
802<xsl:template match="figure|table|example|equation|procedure" mode="toc">
803 <xsl:param name="toc-context" select="."/>
804 <xsl:call-template name="toc.line">
805 <xsl:with-param name="toc-context" select="$toc-context"/>
806 </xsl:call-template>
807</xsl:template>
808
809<!-- ==================================================================== -->
810
811<!-- qandaset handled like a section when qanda.in.toc is set -->
812<xsl:template match="qandaset" mode="toc">
813 <xsl:param name="toc-context" select="."/>
814
815 <xsl:variable name="id">
816 <xsl:call-template name="object.id"/>
817 </xsl:variable>
818
819 <xsl:variable name="cid">
820 <xsl:call-template name="object.id">
821 <xsl:with-param name="object" select="$toc-context"/>
822 </xsl:call-template>
823 </xsl:variable>
824
825 <xsl:variable name="depth" select="count(ancestor::section) + 1"/>
826 <xsl:variable name="reldepth"
827 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
828
829 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
830
831 <xsl:if test="$toc.section.depth &gt;= $depth">
832 <xsl:call-template name="toc.line">
833 <xsl:with-param name="toc-context" select="$toc-context"/>
834 </xsl:call-template>
835
836 <xsl:if test="$toc.section.depth > $depth
837 and $toc.max.depth > $depth.from.context
838 and (child::qandadiv or child::qandaentry)">
839 <fo:block id="toc.{$cid}.{$id}">
840 <xsl:attribute name="margin-left">
841 <xsl:call-template name="set.toc.indent">
842 <xsl:with-param name="reldepth" select="$reldepth"/>
843 </xsl:call-template>
844 </xsl:attribute>
845
846 <xsl:apply-templates select="qandadiv|qandaentry" mode="toc">
847 <xsl:with-param name="toc-context" select="$toc-context"/>
848 </xsl:apply-templates>
849 </fo:block>
850 </xsl:if>
851 </xsl:if>
852</xsl:template>
853
854</xsl:stylesheet>
855
Note: See TracBrowser for help on using the repository browser.