1 <?xml version="1.0" encoding="ASCII"?><!--This file was created automatically by html2xhtml--><!--from the HTML stylesheets.--><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="d" version="1.0">
3 <!-- ********************************************************************
5 This file is part of the XSL DocBook Stylesheet distribution.
6 See ../README or http://cdn.docbook.org/release/xsl/current/ for
7 copyright and other information.
9 ******************************************************************** -->
11 <!-- ==================================================================== -->
13 <xsl:template match="d:set/d:toc | d:book/d:toc | d:part/d:toc">
14 <xsl:variable name="toc.params">
15 <xsl:call-template name="find.path.params">
16 <xsl:with-param name="node" select="parent::*"/>
17 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
21 <!-- Do not output the toc element if one is already generated
22 by the use of $generate.toc parameter, or if
23 generating a source toc is turned off -->
24 <xsl:if test="not(contains($toc.params, 'toc')) and ($process.source.toc != 0 or $process.empty.source.toc != 0)">
25 <xsl:variable name="content">
27 <xsl:when test="* and $process.source.toc != 0">
28 <xsl:apply-templates/>
30 <xsl:when test="count(*) = 0 and $process.empty.source.toc != 0">
31 <!-- trick to switch context node to parent element -->
32 <xsl:for-each select="parent::*">
34 <xsl:when test="self::d:set">
35 <xsl:call-template name="set.toc">
36 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
39 <xsl:when test="self::d:book">
40 <xsl:call-template name="division.toc">
41 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
44 <xsl:when test="self::d:part">
45 <xsl:call-template name="division.toc">
46 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
55 <xsl:if test="string-length(normalize-space($content)) != 0">
56 <xsl:copy-of select="$content"/>
61 <xsl:template match="d:chapter/d:toc | d:appendix/d:toc | d:preface/d:toc | d:article/d:toc">
62 <xsl:variable name="toc.params">
63 <xsl:call-template name="find.path.params">
64 <xsl:with-param name="node" select="parent::*"/>
65 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
69 <!-- Do not output the toc element if one is already generated
70 by the use of $generate.toc parameter, or if
71 generating a source toc is turned off -->
72 <xsl:if test="not(contains($toc.params, 'toc')) and ($process.source.toc != 0 or $process.empty.source.toc != 0)">
74 <xsl:when test="* and $process.source.toc != 0">
76 <xsl:apply-templates select="." mode="common.html.attributes"/>
77 <xsl:call-template name="id.attribute"/>
78 <xsl:apply-templates select="d:title"/>
80 <xsl:apply-templates select="." mode="common.html.attributes"/>
81 <xsl:apply-templates select="*[not(self::d:title)]"/>
84 <xsl:call-template name="component.toc.separator"/>
86 <xsl:when test="count(*) = 0 and $process.empty.source.toc != 0">
87 <!-- trick to switch context node to section element -->
88 <xsl:for-each select="parent::*">
89 <xsl:call-template name="component.toc">
90 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
93 <xsl:call-template name="component.toc.separator"/>
99 <xsl:template match="d:section/d:toc |d:sect1/d:toc |d:sect2/d:toc |d:sect3/d:toc |d:sect4/d:toc |d:sect5/d:toc">
101 <xsl:variable name="toc.params">
102 <xsl:call-template name="find.path.params">
103 <xsl:with-param name="node" select="parent::*"/>
104 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
108 <!-- Do not output the toc element if one is already generated
109 by the use of $generate.toc parameter, or if
110 generating a source toc is turned off -->
111 <xsl:if test="not(contains($toc.params, 'toc')) and ($process.source.toc != 0 or $process.empty.source.toc != 0)">
113 <xsl:when test="* and $process.source.toc != 0">
115 <xsl:apply-templates select="." mode="common.html.attributes"/>
116 <xsl:call-template name="id.attribute"/>
117 <xsl:apply-templates select="d:title"/>
119 <xsl:apply-templates select="." mode="common.html.attributes"/>
120 <xsl:apply-templates select="*[not(self::d:title)]"/>
123 <xsl:call-template name="section.toc.separator"/>
125 <xsl:when test="count(*) = 0 and $process.empty.source.toc != 0">
126 <!-- trick to switch context node to section element -->
127 <xsl:for-each select="parent::*">
128 <xsl:call-template name="section.toc">
129 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
132 <xsl:call-template name="section.toc.separator"/>
138 <!-- ==================================================================== -->
140 <xsl:template match="d:tocpart|d:tocchap |d:toclevel1|d:toclevel2|d:toclevel3|d:toclevel4|d:toclevel5">
141 <xsl:variable name="sub-toc">
142 <xsl:if test="d:tocchap|d:toclevel1|d:toclevel2|d:toclevel3|d:toclevel4|d:toclevel5">
144 <xsl:when test="$toc.list.type = 'dl'">
146 <xsl:apply-templates select="." mode="common.html.attributes"/>
147 <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml">
148 <xsl:apply-templates select="." mode="common.html.attributes"/>
149 <xsl:apply-templates select="d:tocchap|d:toclevel1|d:toclevel2| d:toclevel3|d:toclevel4|d:toclevel5"/>
154 <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml">
155 <xsl:apply-templates select="." mode="common.html.attributes"/>
156 <xsl:apply-templates select="d:tocchap|d:toclevel1|d:toclevel2| d:toclevel3|d:toclevel4|d:toclevel5"/>
163 <xsl:apply-templates select="d:tocentry[position() != last()]"/>
166 <xsl:when test="$toc.list.type = 'dl'">
168 <xsl:apply-templates select="." mode="common.html.attributes"/>
169 <xsl:apply-templates select="d:tocentry[position() = last()]"/>
171 <xsl:copy-of select="$sub-toc"/>
175 <xsl:apply-templates select="." mode="common.html.attributes"/>
176 <xsl:apply-templates select="d:tocentry[position() = last()]"/>
177 <xsl:copy-of select="$sub-toc"/>
183 <xsl:template match="d:tocentry|d:tocdiv|d:lotentry|d:tocfront|d:tocback">
185 <xsl:when test="$toc.list.type = 'dl'">
187 <xsl:apply-templates select="." mode="common.html.attributes"/>
188 <xsl:call-template name="tocentry-content"/>
193 <xsl:apply-templates select="." mode="common.html.attributes"/>
194 <xsl:call-template name="tocentry-content"/>
200 <xsl:template match="d:tocentry[position() = last()]" priority="2">
201 <xsl:call-template name="tocentry-content"/>
204 <xsl:template name="tocentry-content">
205 <xsl:variable name="targets" select="key('id',@linkend)"/>
206 <xsl:variable name="target" select="$targets[1]"/>
209 <xsl:when test="@linkend">
210 <xsl:call-template name="check.id.unique">
211 <xsl:with-param name="linkend" select="@linkend"/>
214 <xsl:attribute name="href">
215 <xsl:call-template name="href.target">
216 <xsl:with-param name="object" select="$target"/>
219 <xsl:apply-templates/>
223 <xsl:apply-templates/>
228 <xsl:template match="d:toc/d:title | d:tocdiv/d:title">
230 <xsl:apply-templates select="." mode="common.html.attributes"/>
231 <xsl:apply-templates/>
235 <xsl:template match="d:toc/d:subtitle | d:tocdiv/d:subtitle">
237 <xsl:apply-templates select="." mode="common.html.attributes"/>
238 <xsl:apply-templates/>
242 <xsl:template match="d:toc/d:titleabbrev | d:tocdiv/d:titleabbrev">
245 <!-- ==================================================================== -->
247 <!-- A lot element must have content, because there is no attribute
248 to select what kind of list should be generated -->
249 <xsl:template match="d:book/d:lot | d:part/d:lot">
250 <!-- Don't generate a page sequence unless there is content -->
251 <xsl:variable name="content">
253 <xsl:when test="* and $process.source.toc != 0">
255 <xsl:apply-templates select="." mode="common.html.attributes"/>
256 <xsl:apply-templates/>
259 <xsl:when test="not(child::*) and $process.empty.source.toc != 0">
260 <xsl:call-template name="process.empty.lot"/>
265 <xsl:if test="string-length(normalize-space($content)) != 0">
266 <xsl:copy-of select="$content"/>
270 <xsl:template match="d:chapter/d:lot | d:appendix/d:lot | d:preface/d:lot | d:article/d:lot">
272 <xsl:when test="* and $process.source.toc != 0">
274 <xsl:apply-templates select="." mode="common.html.attributes"/>
275 <xsl:apply-templates/>
277 <xsl:call-template name="component.toc.separator"/>
279 <xsl:when test="not(child::*) and $process.empty.source.toc != 0">
280 <xsl:call-template name="process.empty.lot"/>
285 <xsl:template match="d:section/d:lot |d:sect1/d:lot |d:sect2/d:lot |d:sect3/d:lot |d:sect4/d:lot |d:sect5/d:lot">
287 <xsl:when test="* and $process.source.toc != 0">
289 <xsl:apply-templates select="." mode="common.html.attributes"/>
290 <xsl:apply-templates/>
292 <xsl:call-template name="section.toc.separator"/>
294 <xsl:when test="not(child::*) and $process.empty.source.toc != 0">
295 <xsl:call-template name="process.empty.lot"/>
300 <xsl:template name="process.empty.lot">
301 <!-- An empty lot element does not provide any information to indicate
302 what should be included in it. You can customize this
303 template to generate a lot based on @role or something -->
305 <xsl:text>Warning: don't know what to generate for </xsl:text>
306 <xsl:text>lot that has no children.</xsl:text>
310 <xsl:template match="d:lot/d:title">
312 <xsl:apply-templates select="." mode="common.html.attributes"/>
313 <xsl:apply-templates/>
317 <xsl:template match="d:lot/d:subtitle">
319 <xsl:apply-templates select="." mode="common.html.attributes"/>
320 <xsl:apply-templates/>
324 <xsl:template match="d:lot/d:titleabbrev">