source: clfs-embedded/BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/xhtml/autotoc.xsl @ 9882b55

Last change on this file since 9882b55 was 9882b55, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added the new lfs-xsl stylesheets.

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