Jitterbug no more.
[fvwm.git] / doc / docbook-xsl / html / autotoc.xsl
blob9d339264f25e6f154d243ddcdcf32e9fe29cd485
1 <?xml version='1.0'?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 version='1.0'>
5 <!-- ********************************************************************
6 $Id: autotoc.xsl,v 1.1 2007/03/10 05:15:13 scott Exp $
7 ********************************************************************
9 This file is part of the XSL DocBook Stylesheet distribution.
10 See ../README or http://nwalsh.com/docbook/xsl/ for copyright
11 and other information.
13 ******************************************************************** -->
15 <xsl:variable name="toc.listitem.type">
16 <xsl:choose>
17 <xsl:when test="$toc.list.type = 'dl'">dt</xsl:when>
18 <xsl:otherwise>li</xsl:otherwise>
19 </xsl:choose>
20 </xsl:variable>
22 <!-- this is just hack because dl and ul aren't completely isomorphic -->
23 <xsl:variable name="toc.dd.type">
24 <xsl:choose>
25 <xsl:when test="$toc.list.type = 'dl'">dd</xsl:when>
26 <xsl:otherwise></xsl:otherwise>
27 </xsl:choose>
28 </xsl:variable>
30 <xsl:template name="make.toc">
31 <xsl:param name="toc-context" select="."/>
32 <xsl:param name="toc.title.p" select="true()"/>
33 <xsl:param name="nodes" select="/NOT-AN-ELEMENT"/>
35 <xsl:variable name="nodes.plus" select="$nodes | qandaset"/>
37 <xsl:variable name="toc.title">
38 <xsl:if test="$toc.title.p">
39 <p>
40 <b>
41 <xsl:call-template name="gentext">
42 <xsl:with-param name="key">TableofContents</xsl:with-param>
43 </xsl:call-template>
44 </b>
45 </p>
46 </xsl:if>
47 </xsl:variable>
49 <xsl:choose>
50 <xsl:when test="$manual.toc != ''">
51 <xsl:variable name="id">
52 <xsl:call-template name="object.id"/>
53 </xsl:variable>
54 <xsl:variable name="toc" select="document($manual.toc, .)"/>
55 <xsl:variable name="tocentry" select="$toc//tocentry[@linkend=$id]"/>
56 <xsl:if test="$tocentry and $tocentry/*">
57 <div class="toc">
58 <xsl:copy-of select="$toc.title"/>
59 <xsl:element name="{$toc.list.type}">
60 <xsl:call-template name="manual-toc">
61 <xsl:with-param name="tocentry" select="$tocentry/*[1]"/>
62 </xsl:call-template>
63 </xsl:element>
64 </div>
65 </xsl:if>
66 </xsl:when>
67 <xsl:otherwise>
68 <xsl:choose>
69 <xsl:when test="$qanda.in.toc != 0">
70 <xsl:if test="$nodes.plus">
71 <div class="toc">
72 <xsl:copy-of select="$toc.title"/>
73 <xsl:element name="{$toc.list.type}">
74 <xsl:apply-templates select="$nodes.plus" mode="toc">
75 <xsl:with-param name="toc-context" select="$toc-context"/>
76 </xsl:apply-templates>
77 </xsl:element>
78 </div>
79 </xsl:if>
80 </xsl:when>
81 <xsl:otherwise>
82 <xsl:if test="$nodes">
83 <div class="toc">
84 <xsl:copy-of select="$toc.title"/>
85 <xsl:element name="{$toc.list.type}">
86 <xsl:apply-templates select="$nodes" mode="toc">
87 <xsl:with-param name="toc-context" select="$toc-context"/>
88 </xsl:apply-templates>
89 </xsl:element>
90 </div>
91 </xsl:if>
92 </xsl:otherwise>
93 </xsl:choose>
95 </xsl:otherwise>
96 </xsl:choose>
97 </xsl:template>
99 <xsl:template name="make.lots">
100 <xsl:param name="toc.params" select="''"/>
101 <xsl:param name="toc"/>
103 <xsl:if test="contains($toc.params, 'toc')">
104 <xsl:copy-of select="$toc"/>
105 </xsl:if>
107 <xsl:if test="contains($toc.params, 'figure')">
108 <xsl:call-template name="list.of.titles">
109 <xsl:with-param name="titles" select="'figure'"/>
110 <xsl:with-param name="nodes" select=".//figure"/>
111 </xsl:call-template>
112 </xsl:if>
114 <xsl:if test="contains($toc.params, 'table')">
115 <xsl:call-template name="list.of.titles">
116 <xsl:with-param name="titles" select="'table'"/>
117 <xsl:with-param name="nodes" select=".//table"/>
118 </xsl:call-template>
119 </xsl:if>
121 <xsl:if test="contains($toc.params, 'example')">
122 <xsl:call-template name="list.of.titles">
123 <xsl:with-param name="titles" select="'example'"/>
124 <xsl:with-param name="nodes" select=".//example"/>
125 </xsl:call-template>
126 </xsl:if>
128 <xsl:if test="contains($toc.params, 'equation')">
129 <xsl:call-template name="list.of.titles">
130 <xsl:with-param name="titles" select="'equation'"/>
131 <xsl:with-param name="nodes" select=".//equation[title or info/title]"/>
132 </xsl:call-template>
133 </xsl:if>
135 <xsl:if test="contains($toc.params, 'procedure')">
136 <xsl:call-template name="list.of.titles">
137 <xsl:with-param name="titles" select="'procedure'"/>
138 <xsl:with-param name="nodes" select=".//procedure[title]"/>
139 </xsl:call-template>
140 </xsl:if>
141 </xsl:template>
143 <!-- ====================================================================== -->
145 <xsl:template name="set.toc">
146 <xsl:param name="toc-context" select="."/>
147 <xsl:param name="toc.title.p" select="true()"/>
149 <xsl:call-template name="make.toc">
150 <xsl:with-param name="toc-context" select="$toc-context"/>
151 <xsl:with-param name="toc.title.p" select="$toc.title.p"/>
152 <xsl:with-param name="nodes" select="book|setindex"/>
153 </xsl:call-template>
154 </xsl:template>
156 <xsl:template name="division.toc">
157 <xsl:param name="toc-context" select="."/>
158 <xsl:param name="toc.title.p" select="true()"/>
160 <xsl:call-template name="make.toc">
161 <xsl:with-param name="toc-context" select="$toc-context"/>
162 <xsl:with-param name="toc.title.p" select="$toc.title.p"/>
163 <xsl:with-param name="nodes" select="part|reference
164 |preface|chapter|appendix
165 |article
166 |bibliography|glossary|index
167 |refentry
168 |bridgehead[$bridgehead.in.toc != 0]"/>
170 </xsl:call-template>
171 </xsl:template>
173 <xsl:template name="component.toc">
174 <xsl:param name="toc-context" select="."/>
175 <xsl:param name="toc.title.p" select="true()"/>
177 <xsl:call-template name="make.toc">
178 <xsl:with-param name="toc-context" select="$toc-context"/>
179 <xsl:with-param name="toc.title.p" select="$toc.title.p"/>
180 <xsl:with-param name="nodes" select="section|sect1
181 |simplesect[$simplesect.in.toc != 0]
182 |refentry
183 |article|bibliography|glossary
184 |appendix|index
185 |bridgehead[not(@renderas)
186 and $bridgehead.in.toc != 0]
187 |.//bridgehead[@renderas='sect1'
188 and $bridgehead.in.toc != 0]"/>
189 </xsl:call-template>
190 </xsl:template>
192 <xsl:template name="component.toc.separator">
193 <!-- Customize to output something between
194 component.toc and first output -->
195 </xsl:template>
197 <xsl:template name="section.toc">
198 <xsl:param name="toc-context" select="."/>
199 <xsl:param name="toc.title.p" select="true()"/>
201 <xsl:call-template name="make.toc">
202 <xsl:with-param name="toc-context" select="$toc-context"/>
203 <xsl:with-param name="toc.title.p" select="$toc.title.p"/>
204 <xsl:with-param name="nodes"
205 select="section|sect1|sect2|sect3|sect4|sect5|refentry
206 |bridgehead[$bridgehead.in.toc != 0]"/>
208 </xsl:call-template>
209 </xsl:template>
211 <xsl:template name="section.toc.separator">
212 <!-- Customize to output something between
213 section.toc and first output -->
214 </xsl:template>
215 <!-- ==================================================================== -->
217 <xsl:template name="subtoc">
218 <xsl:param name="toc-context" select="."/>
219 <xsl:param name="nodes" select="NOT-AN-ELEMENT"/>
221 <xsl:variable name="nodes.plus" select="$nodes | qandaset"/>
223 <xsl:variable name="subtoc">
224 <xsl:element name="{$toc.list.type}">
225 <xsl:choose>
226 <xsl:when test="$qanda.in.toc != 0">
227 <xsl:apply-templates mode="toc" select="$nodes.plus">
228 <xsl:with-param name="toc-context" select="$toc-context"/>
229 </xsl:apply-templates>
230 </xsl:when>
231 <xsl:otherwise>
232 <xsl:apply-templates mode="toc" select="$nodes">
233 <xsl:with-param name="toc-context" select="$toc-context"/>
234 </xsl:apply-templates>
235 </xsl:otherwise>
236 </xsl:choose>
237 </xsl:element>
238 </xsl:variable>
240 <xsl:variable name="depth">
241 <xsl:choose>
242 <xsl:when test="local-name(.) = 'section'">
243 <xsl:value-of select="count(ancestor::section) + 1"/>
244 </xsl:when>
245 <xsl:when test="local-name(.) = 'sect1'">1</xsl:when>
246 <xsl:when test="local-name(.) = 'sect2'">2</xsl:when>
247 <xsl:when test="local-name(.) = 'sect3'">3</xsl:when>
248 <xsl:when test="local-name(.) = 'sect4'">4</xsl:when>
249 <xsl:when test="local-name(.) = 'sect5'">5</xsl:when>
250 <xsl:when test="local-name(.) = 'refsect1'">1</xsl:when>
251 <xsl:when test="local-name(.) = 'refsect2'">2</xsl:when>
252 <xsl:when test="local-name(.) = 'refsect3'">3</xsl:when>
253 <xsl:when test="local-name(.) = 'simplesect'">
254 <!-- sigh... -->
255 <xsl:choose>
256 <xsl:when test="local-name(..) = 'section'">
257 <xsl:value-of select="count(ancestor::section)"/>
258 </xsl:when>
259 <xsl:when test="local-name(..) = 'sect1'">2</xsl:when>
260 <xsl:when test="local-name(..) = 'sect2'">3</xsl:when>
261 <xsl:when test="local-name(..) = 'sect3'">4</xsl:when>
262 <xsl:when test="local-name(..) = 'sect4'">5</xsl:when>
263 <xsl:when test="local-name(..) = 'sect5'">6</xsl:when>
264 <xsl:when test="local-name(..) = 'refsect1'">2</xsl:when>
265 <xsl:when test="local-name(..) = 'refsect2'">3</xsl:when>
266 <xsl:when test="local-name(..) = 'refsect3'">4</xsl:when>
267 <xsl:otherwise>1</xsl:otherwise>
268 </xsl:choose>
269 </xsl:when>
270 <xsl:otherwise>0</xsl:otherwise>
271 </xsl:choose>
272 </xsl:variable>
274 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
276 <xsl:variable name="subtoc.list">
277 <xsl:choose>
278 <xsl:when test="$toc.dd.type = ''">
279 <xsl:copy-of select="$subtoc"/>
280 </xsl:when>
281 <xsl:otherwise>
282 <xsl:element name="{$toc.dd.type}">
283 <xsl:copy-of select="$subtoc"/>
284 </xsl:element>
285 </xsl:otherwise>
286 </xsl:choose>
287 </xsl:variable>
289 <xsl:element name="{$toc.listitem.type}">
290 <xsl:call-template name="toc.line">
291 <xsl:with-param name="toc-context" select="$toc-context"/>
292 </xsl:call-template>
293 <xsl:if test="$toc.listitem.type = 'li'
294 and $toc.section.depth > $depth and
295 ( ($qanda.in.toc = 0 and count($nodes)&gt;0) or
296 ($qanda.in.toc != 0 and count($nodes.plus)&gt;0) )
297 and $toc.max.depth > $depth.from.context">
298 <xsl:copy-of select="$subtoc.list"/>
299 </xsl:if>
300 </xsl:element>
301 <xsl:if test="$toc.listitem.type != 'li'
302 and $toc.section.depth > $depth and
303 ( ($qanda.in.toc = 0 and count($nodes)&gt;0) or
304 ($qanda.in.toc != 0 and count($nodes.plus)&gt;0) )
305 and $toc.max.depth > $depth.from.context">
306 <xsl:copy-of select="$subtoc.list"/>
307 </xsl:if>
308 </xsl:template>
310 <xsl:template name="toc.line">
311 <xsl:param name="toc-context" select="."/>
312 <xsl:param name="depth" select="1"/>
313 <xsl:param name="depth.from.context" select="8"/>
315 <span>
316 <xsl:attribute name="class"><xsl:value-of select="local-name(.)"/></xsl:attribute>
318 <!-- * if $autotoc.label.in.hyperlink is zero, then output the label -->
319 <!-- * before the hyperlinked title (as the DSSSL stylesheet does) -->
320 <xsl:if test="$autotoc.label.in.hyperlink = 0">
321 <xsl:variable name="label">
322 <xsl:apply-templates select="." mode="label.markup"/>
323 </xsl:variable>
324 <xsl:copy-of select="$label"/>
325 <xsl:if test="$label != ''">
326 <xsl:value-of select="$autotoc.label.separator"/>
327 </xsl:if>
328 </xsl:if>
331 <xsl:attribute name="href">
332 <xsl:call-template name="href.target">
333 <xsl:with-param name="context" select="$toc-context"/>
334 </xsl:call-template>
335 </xsl:attribute>
337 <!-- * if $autotoc.label.in.hyperlink is non-zero, then output the label -->
338 <!-- * as part of the hyperlinked title -->
339 <xsl:if test="not($autotoc.label.in.hyperlink = 0)">
340 <xsl:variable name="label">
341 <xsl:apply-templates select="." mode="label.markup"/>
342 </xsl:variable>
343 <xsl:copy-of select="$label"/>
344 <xsl:if test="$label != ''">
345 <xsl:value-of select="$autotoc.label.separator"/>
346 </xsl:if>
347 </xsl:if>
349 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
350 </a>
351 </span>
352 </xsl:template>
354 <xsl:template match="book" mode="toc">
355 <xsl:param name="toc-context" select="."/>
357 <xsl:call-template name="subtoc">
358 <xsl:with-param name="toc-context" select="$toc-context"/>
359 <xsl:with-param name="nodes" select="part|reference
360 |preface|chapter|appendix
361 |article
362 |bibliography|glossary|index
363 |refentry
364 |bridgehead[$bridgehead.in.toc != 0]"/>
365 </xsl:call-template>
366 </xsl:template>
368 <xsl:template match="setindex" mode="toc">
369 <xsl:param name="toc-context" select="."/>
371 <!-- If the setindex tag is not empty, it should be it in the TOC -->
372 <xsl:if test="* or $generate.index != 0">
373 <xsl:call-template name="subtoc">
374 <xsl:with-param name="toc-context" select="$toc-context"/>
375 </xsl:call-template>
376 </xsl:if>
377 </xsl:template>
379 <xsl:template match="part|reference" mode="toc">
380 <xsl:param name="toc-context" select="."/>
382 <xsl:call-template name="subtoc">
383 <xsl:with-param name="toc-context" select="$toc-context"/>
384 <xsl:with-param name="nodes" select="appendix|chapter|article
385 |index|glossary|bibliography
386 |preface|reference|refentry
387 |bridgehead[$bridgehead.in.toc != 0]"/>
388 </xsl:call-template>
389 </xsl:template>
391 <xsl:template match="preface|chapter|appendix|article" mode="toc">
392 <xsl:param name="toc-context" select="."/>
394 <xsl:call-template name="subtoc">
395 <xsl:with-param name="toc-context" select="$toc-context"/>
396 <xsl:with-param name="nodes" select="section|sect1
397 |simplesect[$simplesect.in.toc != 0]
398 |refentry
399 |glossary|bibliography|index
400 |bridgehead[$bridgehead.in.toc != 0]"/>
401 </xsl:call-template>
402 </xsl:template>
404 <xsl:template match="sect1" mode="toc">
405 <xsl:param name="toc-context" select="."/>
406 <xsl:call-template name="subtoc">
407 <xsl:with-param name="toc-context" select="$toc-context"/>
408 <xsl:with-param name="nodes" select="sect2
409 |bridgehead[$bridgehead.in.toc != 0]"/>
410 </xsl:call-template>
411 </xsl:template>
413 <xsl:template match="sect2" mode="toc">
414 <xsl:param name="toc-context" select="."/>
416 <xsl:call-template name="subtoc">
417 <xsl:with-param name="toc-context" select="$toc-context"/>
418 <xsl:with-param name="nodes" select="sect3
419 |bridgehead[$bridgehead.in.toc != 0]"/>
420 </xsl:call-template>
421 </xsl:template>
423 <xsl:template match="sect3" mode="toc">
424 <xsl:param name="toc-context" select="."/>
426 <xsl:call-template name="subtoc">
427 <xsl:with-param name="toc-context" select="$toc-context"/>
428 <xsl:with-param name="nodes" select="sect4
429 |bridgehead[$bridgehead.in.toc != 0]"/>
430 </xsl:call-template>
431 </xsl:template>
433 <xsl:template match="sect4" mode="toc">
434 <xsl:param name="toc-context" select="."/>
436 <xsl:call-template name="subtoc">
437 <xsl:with-param name="toc-context" select="$toc-context"/>
438 <xsl:with-param name="nodes" select="sect5
439 |bridgehead[$bridgehead.in.toc != 0]"/>
440 </xsl:call-template>
441 </xsl:template>
443 <xsl:template match="sect5" mode="toc">
444 <xsl:param name="toc-context" select="."/>
446 <xsl:call-template name="subtoc">
447 <xsl:with-param name="toc-context" select="$toc-context"/>
448 </xsl:call-template>
449 </xsl:template>
451 <xsl:template match="simplesect" mode="toc">
452 <xsl:param name="toc-context" select="."/>
454 <xsl:call-template name="subtoc">
455 <xsl:with-param name="toc-context" select="$toc-context"/>
456 </xsl:call-template>
457 </xsl:template>
459 <xsl:template match="section" mode="toc">
460 <xsl:param name="toc-context" select="."/>
462 <xsl:call-template name="subtoc">
463 <xsl:with-param name="toc-context" select="$toc-context"/>
464 <xsl:with-param name="nodes" select="section
465 |bridgehead[$bridgehead.in.toc != 0]"/>
466 </xsl:call-template>
467 </xsl:template>
469 <xsl:template match="bridgehead" mode="toc">
470 <xsl:param name="toc-context" select="."/>
472 <xsl:if test="$bridgehead.in.toc != 0">
473 <xsl:call-template name="subtoc">
474 <xsl:with-param name="toc-context" select="$toc-context"/>
475 </xsl:call-template>
476 </xsl:if>
477 </xsl:template>
479 <xsl:template match="bibliography|glossary" mode="toc">
480 <xsl:param name="toc-context" select="."/>
482 <xsl:call-template name="subtoc">
483 <xsl:with-param name="toc-context" select="$toc-context"/>
484 </xsl:call-template>
485 </xsl:template>
487 <xsl:template match="index" mode="toc">
488 <xsl:param name="toc-context" select="."/>
490 <!-- If the index tag is not empty, it should be it in the TOC -->
491 <xsl:if test="* or $generate.index != 0">
492 <xsl:call-template name="subtoc">
493 <xsl:with-param name="toc-context" select="$toc-context"/>
494 </xsl:call-template>
495 </xsl:if>
496 </xsl:template>
498 <xsl:template match="refentry" mode="toc">
499 <xsl:param name="toc-context" select="."/>
501 <xsl:variable name="refmeta" select=".//refmeta"/>
502 <xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
503 <xsl:variable name="refnamediv" select=".//refnamediv"/>
504 <xsl:variable name="refname" select="$refnamediv//refname"/>
505 <xsl:variable name="refdesc" select="$refnamediv//refdescriptor"/>
506 <xsl:variable name="title">
507 <xsl:choose>
508 <xsl:when test="$refentrytitle">
509 <xsl:apply-templates select="$refentrytitle[1]"
510 mode="titleabbrev.markup"/>
511 </xsl:when>
512 <xsl:when test="$refdesc">
513 <xsl:apply-templates select="$refdesc"
514 mode="titleabbrev.markup"/>
515 </xsl:when>
516 <xsl:when test="$refname">
517 <xsl:apply-templates select="$refname[1]"
518 mode="titleabbrev.markup"/>
519 </xsl:when>
520 </xsl:choose>
521 </xsl:variable>
523 <xsl:element name="{$toc.listitem.type}">
524 <span class='refentrytitle'>
526 <xsl:attribute name="href">
527 <xsl:call-template name="href.target"/>
528 </xsl:attribute>
529 <xsl:copy-of select="$title"/>
530 </a>
531 </span>
532 <span class='refpurpose'>
533 <xsl:if test="$annotate.toc != 0">
534 <!-- * DocBook 5 says inlinemediaobject (among other things) -->
535 <!-- * is allowed in refpurpose; so we need to run -->
536 <!-- * apply-templates on refpurpose here, instead of value-of -->
537 <xsl:apply-templates select="refnamediv/refpurpose"/>
538 </xsl:if>
539 </span>
540 </xsl:element>
541 </xsl:template>
543 <xsl:template match="title" mode="toc">
544 <xsl:param name="toc-context" select="."/>
547 <xsl:attribute name="href">
548 <xsl:call-template name="href.target">
549 <xsl:with-param name="object" select=".."/>
550 </xsl:call-template>
551 </xsl:attribute>
552 <xsl:apply-templates/>
553 </a>
554 </xsl:template>
556 <xsl:template name="manual-toc">
557 <xsl:param name="toc-context" select="."/>
558 <xsl:param name="tocentry"/>
560 <!-- be careful, we don't want to change the current document to the other tree! -->
562 <xsl:if test="$tocentry">
563 <xsl:variable name="node" select="key('id', $tocentry/@linkend)"/>
565 <xsl:element name="{$toc.listitem.type}">
566 <xsl:variable name="label">
567 <xsl:apply-templates select="$node" mode="label.markup"/>
568 </xsl:variable>
569 <xsl:copy-of select="$label"/>
570 <xsl:if test="$label != ''">
571 <xsl:value-of select="$autotoc.label.separator"/>
572 </xsl:if>
574 <xsl:attribute name="href">
575 <xsl:call-template name="href.target">
576 <xsl:with-param name="object" select="$node"/>
577 </xsl:call-template>
578 </xsl:attribute>
579 <xsl:apply-templates select="$node" mode="titleabbrev.markup"/>
580 </a>
581 </xsl:element>
583 <xsl:if test="$tocentry/*">
584 <xsl:element name="{$toc.list.type}">
585 <xsl:call-template name="manual-toc">
586 <xsl:with-param name="tocentry" select="$tocentry/*[1]"/>
587 </xsl:call-template>
588 </xsl:element>
589 </xsl:if>
591 <xsl:if test="$tocentry/following-sibling::*">
592 <xsl:call-template name="manual-toc">
593 <xsl:with-param name="tocentry" select="$tocentry/following-sibling::*[1]"/>
594 </xsl:call-template>
595 </xsl:if>
596 </xsl:if>
597 </xsl:template>
599 <!-- ==================================================================== -->
601 <xsl:template name="list.of.titles">
602 <xsl:param name="toc-context" select="."/>
603 <xsl:param name="titles" select="'table'"/>
604 <xsl:param name="nodes" select=".//table"/>
606 <xsl:if test="$nodes">
607 <div class="list-of-{$titles}s">
610 <xsl:call-template name="gentext">
611 <xsl:with-param name="key">
612 <xsl:choose>
613 <xsl:when test="$titles='table'">ListofTables</xsl:when>
614 <xsl:when test="$titles='figure'">ListofFigures</xsl:when>
615 <xsl:when test="$titles='equation'">ListofEquations</xsl:when>
616 <xsl:when test="$titles='example'">ListofExamples</xsl:when>
617 <xsl:when test="$titles='procedure'">ListofProcedures</xsl:when>
618 <xsl:otherwise>ListofUnknown</xsl:otherwise>
619 </xsl:choose>
620 </xsl:with-param>
621 </xsl:call-template>
622 </b>
623 </p>
625 <xsl:element name="{$toc.list.type}">
626 <xsl:apply-templates select="$nodes" mode="toc">
627 <xsl:with-param name="toc-context" select="$toc-context"/>
628 </xsl:apply-templates>
629 </xsl:element>
630 </div>
631 </xsl:if>
632 </xsl:template>
634 <xsl:template match="figure|table|example|equation|procedure" mode="toc">
635 <xsl:param name="toc-context" select="."/>
637 <xsl:element name="{$toc.listitem.type}">
638 <xsl:variable name="label">
639 <xsl:apply-templates select="." mode="label.markup"/>
640 </xsl:variable>
641 <xsl:copy-of select="$label"/>
642 <xsl:if test="$label != ''">
643 <xsl:value-of select="$autotoc.label.separator"/>
644 </xsl:if>
646 <xsl:attribute name="href">
647 <xsl:call-template name="href.target"/>
648 </xsl:attribute>
649 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
650 </a>
651 </xsl:element>
652 </xsl:template>
654 <!-- Used only if qanda.in.toc parameter is non-zero -->
655 <xsl:template match="qandaset" mode="toc">
656 <xsl:param name="toc-context" select="."/>
657 <xsl:call-template name="subtoc">
658 <xsl:with-param name="toc-context" select="$toc-context"/>
659 <xsl:with-param name="nodes" select="qandadiv | qandaentry"/>
660 </xsl:call-template>
661 </xsl:template>
663 <xsl:template match="qandadiv|qandaentry" mode="toc">
664 <xsl:apply-templates select="." mode="qandatoc.mode"/>
665 </xsl:template>
667 </xsl:stylesheet>