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