1 <?xml version="1.0" encoding="US-ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets. Do not edit this file.-->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
6 <!-- ********************************************************************
8 ********************************************************************
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://nwalsh.com/docbook/xsl/ for copyright
12 and other information.
14 ******************************************************************** -->
16 <xsl:variable name="toc.listitem.type">
18 <xsl:when test="$toc.list.type = 'dl'">dt</xsl:when>
19 <xsl:otherwise>li</xsl:otherwise>
23 <!-- this is just hack because dl and ul aren't completely isomorphic -->
24 <xsl:variable name="toc.dd.type">
26 <xsl:when test="$toc.list.type = 'dl'">dd</xsl:when>
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"/>
36 <xsl:variable name="toc.title">
37 <xsl:if test="$toc.title.p">
40 <xsl:call-template name="gentext">
41 <xsl:with-param name="key">TableofContents</xsl:with-param>
49 <xsl:when test="$manual.toc != ''">
50 <xsl:variable name="id">
51 <xsl:call-template name="object.id"/>
53 <xsl:variable name="toc" select="document($manual.toc, .)"/>
54 <xsl:variable name="tocentry" select="$toc//tocentry[@linkend=$id]"/>
55 <xsl:if test="$tocentry and $tocentry/*">
57 <xsl:copy-of select="$toc.title"/>
58 <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml">
59 <xsl:call-template name="manual-toc">
60 <xsl:with-param name="tocentry" select="$tocentry/*[1]"/>
67 <xsl:if test="$nodes">
69 <xsl:copy-of select="$toc.title"/>
70 <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml">
71 <xsl:apply-templates select="$nodes" mode="toc">
72 <xsl:with-param name="toc-context" select="$toc-context"/>
73 </xsl:apply-templates>
81 <xsl:template name="make.lots">
82 <xsl:param name="toc.params" select="''"/>
83 <xsl:param name="toc"/>
85 <xsl:if test="contains($toc.params, 'toc')">
86 <xsl:copy-of select="$toc"/>
89 <xsl:if test="contains($toc.params, 'figure')">
90 <xsl:call-template name="list.of.titles">
91 <xsl:with-param name="titles" select="'figure'"/>
92 <xsl:with-param name="nodes" select=".//figure"/>
96 <xsl:if test="contains($toc.params, 'table')">
97 <xsl:call-template name="list.of.titles">
98 <xsl:with-param name="titles" select="'table'"/>
99 <xsl:with-param name="nodes" select=".//table"/>
103 <xsl:if test="contains($toc.params, 'example')">
104 <xsl:call-template name="list.of.titles">
105 <xsl:with-param name="titles" select="'example'"/>
106 <xsl:with-param name="nodes" select=".//example"/>
110 <xsl:if test="contains($toc.params, 'equation')">
111 <xsl:call-template name="list.of.titles">
112 <xsl:with-param name="titles" select="'equation'"/>
113 <xsl:with-param name="nodes" select=".//equation[title]"/>
117 <xsl:if test="contains($toc.params, 'procedure')">
118 <xsl:call-template name="list.of.titles">
119 <xsl:with-param name="titles" select="'procedure'"/>
120 <xsl:with-param name="nodes" select=".//procedure[title]"/>
125 <!-- ====================================================================== -->
127 <xsl:template name="set.toc">
128 <xsl:param name="toc-context" select="."/>
130 <xsl:call-template name="make.toc">
131 <xsl:with-param name="toc-context" select="$toc-context"/>
132 <xsl:with-param name="nodes" select="book|setindex"/>
136 <xsl:template name="division.toc">
137 <xsl:param name="toc-context" select="."/>
139 <xsl:call-template name="make.toc">
140 <xsl:with-param name="toc-context" select="$toc-context"/>
141 <xsl:with-param name="nodes" select="part|reference |preface|chapter|appendix |article |bibliography|glossary|index |refentry |bridgehead[$bridgehead.in.toc != 0]"/>
146 <xsl:template name="component.toc">
147 <xsl:param name="toc-context" select="."/>
148 <xsl:param name="toc.title.p" select="true()"/>
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="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]"/>
157 <xsl:template name="component.toc.separator">
158 <!-- Customize to output something between
159 component.toc and first output -->
162 <xsl:template name="section.toc">
163 <xsl:param name="toc-context" select="."/>
164 <xsl:param name="toc.title.p" select="true()"/>
166 <xsl:call-template name="make.toc">
167 <xsl:with-param name="toc-context" select="$toc-context"/>
168 <xsl:with-param name="toc.title.p" select="$toc.title.p"/>
169 <xsl:with-param name="nodes" select="section|sect1|sect2|sect3|sect4|sect5|refentry |bridgehead[$bridgehead.in.toc != 0]"/>
174 <xsl:template name="section.toc.separator">
175 <!-- Customize to output something between
176 section.toc and first output -->
178 <!-- ==================================================================== -->
180 <xsl:template name="subtoc">
181 <xsl:param name="toc-context" select="."/>
182 <xsl:param name="nodes" select="NOT-AN-ELEMENT"/>
184 <xsl:variable name="subtoc">
185 <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml">
186 <xsl:apply-templates mode="toc" select="$nodes">
187 <xsl:with-param name="toc-context" select="$toc-context"/>
188 </xsl:apply-templates>
192 <xsl:variable name="depth">
194 <xsl:when test="local-name(.) = 'section'">
195 <xsl:value-of select="count(ancestor::section) + 1"/>
197 <xsl:when test="local-name(.) = 'sect1'">1</xsl:when>
198 <xsl:when test="local-name(.) = 'sect2'">2</xsl:when>
199 <xsl:when test="local-name(.) = 'sect3'">3</xsl:when>
200 <xsl:when test="local-name(.) = 'sect4'">4</xsl:when>
201 <xsl:when test="local-name(.) = 'sect5'">5</xsl:when>
202 <xsl:when test="local-name(.) = 'refsect1'">1</xsl:when>
203 <xsl:when test="local-name(.) = 'refsect2'">2</xsl:when>
204 <xsl:when test="local-name(.) = 'refsect3'">3</xsl:when>
205 <xsl:when test="local-name(.) = 'simplesect'">
208 <xsl:when test="local-name(..) = 'section'">
209 <xsl:value-of select="count(ancestor::section)"/>
211 <xsl:when test="local-name(..) = 'sect1'">2</xsl:when>
212 <xsl:when test="local-name(..) = 'sect2'">3</xsl:when>
213 <xsl:when test="local-name(..) = 'sect3'">4</xsl:when>
214 <xsl:when test="local-name(..) = 'sect4'">5</xsl:when>
215 <xsl:when test="local-name(..) = 'sect5'">6</xsl:when>
216 <xsl:when test="local-name(..) = 'refsect1'">2</xsl:when>
217 <xsl:when test="local-name(..) = 'refsect2'">3</xsl:when>
218 <xsl:when test="local-name(..) = 'refsect3'">4</xsl:when>
219 <xsl:otherwise>1</xsl:otherwise>
222 <xsl:otherwise>0</xsl:otherwise>
226 <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
228 <xsl:variable name="subtoc.list">
230 <xsl:when test="$toc.dd.type = ''">
231 <xsl:copy-of select="$subtoc"/>
234 <xsl:element name="{$toc.dd.type}" namespace="http://www.w3.org/1999/xhtml">
235 <xsl:copy-of select="$subtoc"/>
241 <xsl:element name="{$toc.listitem.type}" namespace="http://www.w3.org/1999/xhtml">
242 <xsl:call-template name="toc.line">
243 <xsl:with-param name="toc-context" select="$toc-context"/>
245 <xsl:if test="$toc.listitem.type = 'li' and $toc.section.depth > $depth and count($nodes)>0 and $toc.max.depth > $depth.from.context">
246 <xsl:copy-of select="$subtoc.list"/>
249 <xsl:if test="$toc.listitem.type != 'li' and $toc.section.depth > $depth and count($nodes)>0 and $toc.max.depth > $depth.from.context">
250 <xsl:copy-of select="$subtoc.list"/>
254 <xsl:template name="toc.line">
255 <xsl:param name="toc-context" select="."/>
256 <xsl:param name="depth" select="1"/>
257 <xsl:param name="depth.from.context" select="8"/>
260 <xsl:attribute name="class"><xsl:value-of select="local-name(.)"/></xsl:attribute>
262 <xsl:attribute name="href">
263 <xsl:call-template name="href.target">
264 <xsl:with-param name="context" select="$toc-context"/>
268 <xsl:variable name="label">
269 <xsl:apply-templates select="." mode="label.markup"/>
271 <xsl:copy-of select="$label"/>
272 <xsl:if test="$label != ''">
273 <xsl:value-of select="$autotoc.label.separator"/>
276 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
281 <xsl:template match="book" mode="toc">
282 <xsl:param name="toc-context" select="."/>
284 <xsl:call-template name="subtoc">
285 <xsl:with-param name="toc-context" select="$toc-context"/>
286 <xsl:with-param name="nodes" select="part|reference |preface|chapter|appendix |article |bibliography|glossary|index |refentry |bridgehead[$bridgehead.in.toc != 0]"/>
290 <xsl:template match="setindex" mode="toc">
291 <xsl:param name="toc-context" select="."/>
293 <!-- If the setindex tag is not empty, it should be it in the TOC -->
294 <xsl:if test="* or $generate.index != 0">
295 <xsl:call-template name="subtoc">
296 <xsl:with-param name="toc-context" select="$toc-context"/>
301 <xsl:template match="part|reference" mode="toc">
302 <xsl:param name="toc-context" select="."/>
304 <xsl:call-template name="subtoc">
305 <xsl:with-param name="toc-context" select="$toc-context"/>
306 <xsl:with-param name="nodes" select="appendix|chapter|article |index|glossary|bibliography |preface|reference|refentry |bridgehead[$bridgehead.in.toc != 0]"/>
310 <xsl:template match="preface|chapter|appendix|article" mode="toc">
311 <xsl:param name="toc-context" select="."/>
313 <xsl:call-template name="subtoc">
314 <xsl:with-param name="toc-context" select="$toc-context"/>
315 <xsl:with-param name="nodes" select="section|sect1 |simplesect[$simplesect.in.toc != 0] |refentry |glossary|bibliography|index |bridgehead[$bridgehead.in.toc != 0]"/>
319 <xsl:template match="sect1" mode="toc">
320 <xsl:param name="toc-context" select="."/>
321 <xsl:call-template name="subtoc">
322 <xsl:with-param name="toc-context" select="$toc-context"/>
323 <xsl:with-param name="nodes" select="sect2 |bridgehead[$bridgehead.in.toc != 0]"/>
327 <xsl:template match="sect2" mode="toc">
328 <xsl:param name="toc-context" select="."/>
330 <xsl:call-template name="subtoc">
331 <xsl:with-param name="toc-context" select="$toc-context"/>
332 <xsl:with-param name="nodes" select="sect3 |bridgehead[$bridgehead.in.toc != 0]"/>
336 <xsl:template match="sect3" mode="toc">
337 <xsl:param name="toc-context" select="."/>
339 <xsl:call-template name="subtoc">
340 <xsl:with-param name="toc-context" select="$toc-context"/>
341 <xsl:with-param name="nodes" select="sect4 |bridgehead[$bridgehead.in.toc != 0]"/>
345 <xsl:template match="sect4" mode="toc">
346 <xsl:param name="toc-context" select="."/>
348 <xsl:call-template name="subtoc">
349 <xsl:with-param name="toc-context" select="$toc-context"/>
350 <xsl:with-param name="nodes" select="sect5 |bridgehead[$bridgehead.in.toc != 0]"/>
354 <xsl:template match="sect5" 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"/>
362 <xsl:template match="simplesect" mode="toc">
363 <xsl:param name="toc-context" select="."/>
365 <xsl:call-template name="subtoc">
366 <xsl:with-param name="toc-context" select="$toc-context"/>
370 <xsl:template match="section" mode="toc">
371 <xsl:param name="toc-context" select="."/>
373 <xsl:call-template name="subtoc">
374 <xsl:with-param name="toc-context" select="$toc-context"/>
375 <xsl:with-param name="nodes" select="section |bridgehead[$bridgehead.in.toc != 0]"/>
379 <xsl:template match="bridgehead" mode="toc">
380 <xsl:param name="toc-context" select="."/>
382 <xsl:if test="$bridgehead.in.toc != 0">
383 <xsl:call-template name="subtoc">
384 <xsl:with-param name="toc-context" select="$toc-context"/>
389 <xsl:template match="bibliography|glossary" mode="toc">
390 <xsl:param name="toc-context" select="."/>
392 <xsl:call-template name="subtoc">
393 <xsl:with-param name="toc-context" select="$toc-context"/>
397 <xsl:template match="index" mode="toc">
398 <xsl:param name="toc-context" select="."/>
400 <!-- If the index tag is not empty, it should be it in the TOC -->
401 <xsl:if test="* or $generate.index != 0">
402 <xsl:call-template name="subtoc">
403 <xsl:with-param name="toc-context" select="$toc-context"/>
408 <xsl:template match="refentry" mode="toc">
409 <xsl:param name="toc-context" select="."/>
411 <xsl:variable name="refmeta" select=".//refmeta"/>
412 <xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
413 <xsl:variable name="refnamediv" select=".//refnamediv"/>
414 <xsl:variable name="refname" select="$refnamediv//refname"/>
415 <xsl:variable name="refdesc" select="$refnamediv//refdescriptor"/>
416 <xsl:variable name="title">
418 <xsl:when test="$refentrytitle">
419 <xsl:apply-templates select="$refentrytitle[1]" mode="titleabbrev.markup"/>
421 <xsl:when test="$refdesc">
422 <xsl:apply-templates select="$refdesc" mode="titleabbrev.markup"/>
424 <xsl:when test="$refname">
425 <xsl:apply-templates select="$refname[1]" mode="titleabbrev.markup"/>
430 <xsl:element name="{$toc.listitem.type}" namespace="http://www.w3.org/1999/xhtml">
431 <span class="refentrytitle">
433 <xsl:attribute name="href">
434 <xsl:call-template name="href.target"/>
436 <xsl:copy-of select="$title"/>
439 <span class="refpurpose">
440 <xsl:if test="$annotate.toc != 0">
441 <xsl:text> - </xsl:text>
442 <xsl:value-of select="refnamediv/refpurpose"/>
448 <xsl:template match="title" mode="toc">
449 <xsl:param name="toc-context" select="."/>
452 <xsl:attribute name="href">
453 <xsl:call-template name="href.target">
454 <xsl:with-param name="object" select=".."/>
457 <xsl:apply-templates/>
461 <xsl:template name="manual-toc">
462 <xsl:param name="toc-context" select="."/>
463 <xsl:param name="tocentry"/>
465 <!-- be careful, we don't want to change the current document to the other tree! -->
467 <xsl:if test="$tocentry">
468 <xsl:variable name="node" select="key('id', $tocentry/@linkend)"/>
470 <xsl:element name="{$toc.listitem.type}" namespace="http://www.w3.org/1999/xhtml">
471 <xsl:variable name="label">
472 <xsl:apply-templates select="$node" mode="label.markup"/>
474 <xsl:copy-of select="$label"/>
475 <xsl:if test="$label != ''">
476 <xsl:value-of select="$autotoc.label.separator"/>
479 <xsl:attribute name="href">
480 <xsl:call-template name="href.target">
481 <xsl:with-param name="object" select="$node"/>
484 <xsl:apply-templates select="$node" mode="titleabbrev.markup"/>
488 <xsl:if test="$tocentry/*">
489 <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml">
490 <xsl:call-template name="manual-toc">
491 <xsl:with-param name="tocentry" select="$tocentry/*[1]"/>
496 <xsl:if test="$tocentry/following-sibling::*">
497 <xsl:call-template name="manual-toc">
498 <xsl:with-param name="tocentry" select="$tocentry/following-sibling::*[1]"/>
504 <!-- ==================================================================== -->
506 <xsl:template name="list.of.titles">
507 <xsl:param name="toc-context" select="."/>
508 <xsl:param name="titles" select="'table'"/>
509 <xsl:param name="nodes" select=".//table"/>
511 <xsl:if test="$nodes">
512 <div class="list-of-{$titles}s">
515 <xsl:call-template name="gentext">
516 <xsl:with-param name="key">
518 <xsl:when test="$titles='table'">ListofTables</xsl:when>
519 <xsl:when test="$titles='figure'">ListofFigures</xsl:when>
520 <xsl:when test="$titles='equation'">ListofEquations</xsl:when>
521 <xsl:when test="$titles='example'">ListofExamples</xsl:when>
522 <xsl:when test="$titles='procedure'">ListofProcedures</xsl:when>
523 <xsl:otherwise>ListofUnknown</xsl:otherwise>
530 <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml">
531 <xsl:apply-templates select="$nodes" mode="toc">
532 <xsl:with-param name="toc-context" select="$toc-context"/>
533 </xsl:apply-templates>
539 <xsl:template match="figure|table|example|equation|procedure" mode="toc">
540 <xsl:param name="toc-context" select="."/>
542 <xsl:element name="{$toc.listitem.type}" namespace="http://www.w3.org/1999/xhtml">
543 <xsl:variable name="label">
544 <xsl:apply-templates select="." mode="label.markup"/>
546 <xsl:copy-of select="$label"/>
547 <xsl:if test="$label != ''">
548 <xsl:value-of select="$autotoc.label.separator"/>
551 <xsl:attribute name="href">
552 <xsl:call-template name="href.target"/>
554 <xsl:apply-templates select="." mode="titleabbrev.markup"/>