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 > $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"> |
---|
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 > $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"> |
---|
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:with-param name="toc-context" select="$toc-context"/> |
---|
313 | </xsl:call-template> |
---|
314 | </xsl:attribute> |
---|
315 | |
---|
316 | <!-- * if $autotoc.label.in.hyperlink is non-zero, then output the label --> |
---|
317 | <!-- * as part of the hyperlinked title --> |
---|
318 | <xsl:if test="not($autotoc.label.in.hyperlink = 0)"> |
---|
319 | <xsl:variable name="label"> |
---|
320 | <xsl:apply-templates select="." mode="label.markup"/> |
---|
321 | </xsl:variable> |
---|
322 | <xsl:copy-of select="$label"/> |
---|
323 | <xsl:if test="$label != ''"> |
---|
324 | <xsl:value-of select="$autotoc.label.separator"/> |
---|
325 | </xsl:if> |
---|
326 | </xsl:if> |
---|
327 | |
---|
328 | <xsl:apply-templates select="." mode="titleabbrev.markup"/> |
---|
329 | </a> |
---|
330 | </span> |
---|
331 | </xsl:template> |
---|
332 | |
---|
333 | <xsl:template match="book" mode="toc"> |
---|
334 | <xsl:param name="toc-context" select="."/> |
---|
335 | |
---|
336 | <xsl:call-template name="subtoc"> |
---|
337 | <xsl:with-param name="toc-context" select="$toc-context"/> |
---|
338 | <xsl:with-param name="nodes" select="part|reference |preface|chapter|appendix |article |bibliography|glossary|index |refentry |bridgehead[$bridgehead.in.toc != 0]"/> |
---|
339 | </xsl:call-template> |
---|
340 | </xsl:template> |
---|
341 | |
---|
342 | <xsl:template match="setindex" mode="toc"> |
---|
343 | <xsl:param name="toc-context" select="."/> |
---|
344 | |
---|
345 | <!-- If the setindex tag is not empty, it should be it in the TOC --> |
---|
346 | <xsl:if test="* or $generate.index != 0"> |
---|
347 | <xsl:call-template name="subtoc"> |
---|
348 | <xsl:with-param name="toc-context" select="$toc-context"/> |
---|
349 | </xsl:call-template> |
---|
350 | </xsl:if> |
---|
351 | </xsl:template> |
---|
352 | |
---|
353 | <xsl:template match="part|reference" mode="toc"> |
---|
354 | <xsl:param name="toc-context" select="."/> |
---|
355 | |
---|
356 | <xsl:call-template name="subtoc"> |
---|
357 | <xsl:with-param name="toc-context" select="$toc-context"/> |
---|
358 | <xsl:with-param name="nodes" select="appendix|chapter|article |index|glossary|bibliography |preface|reference|refentry |bridgehead[$bridgehead.in.toc != 0]"/> |
---|
359 | </xsl:call-template> |
---|
360 | </xsl:template> |
---|
361 | |
---|
362 | <xsl:template match="preface|chapter|appendix|article" mode="toc"> |
---|
363 | <xsl:param name="toc-context" select="."/> |
---|
364 | |
---|
365 | <xsl:call-template name="subtoc"> |
---|
366 | <xsl:with-param name="toc-context" select="$toc-context"/> |
---|
367 | <xsl:with-param name="nodes" select="section|sect1 |simplesect[$simplesect.in.toc != 0] |refentry |glossary|bibliography|index |bridgehead[$bridgehead.in.toc != 0]"/> |
---|
368 | </xsl:call-template> |
---|
369 | </xsl:template> |
---|
370 | |
---|
371 | <xsl:template match="sect1" mode="toc"> |
---|
372 | <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="sect2 |bridgehead[$bridgehead.in.toc != 0]"/> |
---|
376 | </xsl:call-template> |
---|
377 | </xsl:template> |
---|
378 | |
---|
379 | <xsl:template match="sect2" mode="toc"> |
---|
380 | <xsl:param name="toc-context" select="."/> |
---|
381 | |
---|
382 | <xsl:call-template name="subtoc"> |
---|
383 | <xsl:with-param name="toc-context" select="$toc-context"/> |
---|
384 | <xsl:with-param name="nodes" select="sect3 |bridgehead[$bridgehead.in.toc != 0]"/> |
---|
385 | </xsl:call-template> |
---|
386 | </xsl:template> |
---|
387 | |
---|
388 | <xsl:template match="sect3" mode="toc"> |
---|
389 | <xsl:param name="toc-context" select="."/> |
---|
390 | |
---|
391 | <xsl:call-template name="subtoc"> |
---|
392 | <xsl:with-param name="toc-context" select="$toc-context"/> |
---|
393 | <xsl:with-param name="nodes" select="sect4 |bridgehead[$bridgehead.in.toc != 0]"/> |
---|
394 | </xsl:call-template> |
---|
395 | </xsl:template> |
---|
396 | |
---|
397 | <xsl:template match="sect4" mode="toc"> |
---|
398 | <xsl:param name="toc-context" select="."/> |
---|
399 | |
---|
400 | <xsl:call-template name="subtoc"> |
---|
401 | <xsl:with-param name="toc-context" select="$toc-context"/> |
---|
402 | <xsl:with-param name="nodes" select="sect5 |bridgehead[$bridgehead.in.toc != 0]"/> |
---|
403 | </xsl:call-template> |
---|
404 | </xsl:template> |
---|
405 | |
---|
406 | <xsl:template match="sect5" mode="toc"> |
---|
407 | <xsl:param name="toc-context" select="."/> |
---|
408 | |
---|
409 | <xsl:call-template name="subtoc"> |
---|
410 | <xsl:with-param name="toc-context" select="$toc-context"/> |
---|
411 | </xsl:call-template> |
---|
412 | </xsl:template> |
---|
413 | |
---|
414 | <xsl:template match="simplesect" mode="toc"> |
---|
415 | <xsl:param name="toc-context" select="."/> |
---|
416 | |
---|
417 | <xsl:call-template name="subtoc"> |
---|
418 | <xsl:with-param name="toc-context" select="$toc-context"/> |
---|
419 | </xsl:call-template> |
---|
420 | </xsl:template> |
---|
421 | |
---|
422 | <xsl:template match="section" mode="toc"> |
---|
423 | <xsl:param name="toc-context" select="."/> |
---|
424 | |
---|
425 | <xsl:call-template name="subtoc"> |
---|
426 | <xsl:with-param name="toc-context" select="$toc-context"/> |
---|
427 | <xsl:with-param name="nodes" select="section |bridgehead[$bridgehead.in.toc != 0]"/> |
---|
428 | </xsl:call-template> |
---|
429 | </xsl:template> |
---|
430 | |
---|
431 | <xsl:template match="bridgehead" mode="toc"> |
---|
432 | <xsl:param name="toc-context" select="."/> |
---|
433 | |
---|
434 | <xsl:if test="$bridgehead.in.toc != 0"> |
---|
435 | <xsl:call-template name="subtoc"> |
---|
436 | <xsl:with-param name="toc-context" select="$toc-context"/> |
---|
437 | </xsl:call-template> |
---|
438 | </xsl:if> |
---|
439 | </xsl:template> |
---|
440 | |
---|
441 | <xsl:template match="bibliography|glossary" mode="toc"> |
---|
442 | <xsl:param name="toc-context" select="."/> |
---|
443 | |
---|
444 | <xsl:call-template name="subtoc"> |
---|
445 | <xsl:with-param name="toc-context" select="$toc-context"/> |
---|
446 | </xsl:call-template> |
---|
447 | </xsl:template> |
---|
448 | |
---|
449 | <xsl:template match="index" mode="toc"> |
---|
450 | <xsl:param name="toc-context" select="."/> |
---|
451 | |
---|
452 | <!-- If the index tag is not empty, it should be it in the TOC --> |
---|
453 | <xsl:if test="* or $generate.index != 0"> |
---|
454 | <xsl:call-template name="subtoc"> |
---|
455 | <xsl:with-param name="toc-context" select="$toc-context"/> |
---|
456 | </xsl:call-template> |
---|
457 | </xsl:if> |
---|
458 | </xsl:template> |
---|
459 | |
---|
460 | <xsl:template match="refentry" mode="toc"> |
---|
461 | <xsl:param name="toc-context" select="."/> |
---|
462 | |
---|
463 | <xsl:variable name="refmeta" select=".//refmeta"/> |
---|
464 | <xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/> |
---|
465 | <xsl:variable name="refnamediv" select=".//refnamediv"/> |
---|
466 | <xsl:variable name="refname" select="$refnamediv//refname"/> |
---|
467 | <xsl:variable name="refdesc" select="$refnamediv//refdescriptor"/> |
---|
468 | <xsl:variable name="title"> |
---|
469 | <xsl:choose> |
---|
470 | <xsl:when test="$refentrytitle"> |
---|
471 | <xsl:apply-templates select="$refentrytitle[1]" mode="titleabbrev.markup"/> |
---|
472 | </xsl:when> |
---|
473 | <xsl:when test="$refdesc"> |
---|
474 | <xsl:apply-templates select="$refdesc" mode="titleabbrev.markup"/> |
---|
475 | </xsl:when> |
---|
476 | <xsl:when test="$refname"> |
---|
477 | <xsl:apply-templates select="$refname[1]" mode="titleabbrev.markup"/> |
---|
478 | </xsl:when> |
---|
479 | </xsl:choose> |
---|
480 | </xsl:variable> |
---|
481 | |
---|
482 | <xsl:element name="{$toc.listitem.type}" namespace="http://www.w3.org/1999/xhtml"> |
---|
483 | <span class="refentrytitle"> |
---|
484 | <a> |
---|
485 | <xsl:attribute name="href"> |
---|
486 | <xsl:call-template name="href.target"> |
---|
487 | <xsl:with-param name="toc-context" select="$toc-context"/> |
---|
488 | </xsl:call-template> |
---|
489 | </xsl:attribute> |
---|
490 | <xsl:copy-of select="$title"/> |
---|
491 | </a> |
---|
492 | </span> |
---|
493 | <span class="refpurpose"> |
---|
494 | <xsl:if test="$annotate.toc != 0"> |
---|
495 | <!-- * DocBook 5 says inlinemediaobject (among other things) --> |
---|
496 | <!-- * is allowed in refpurpose; so we need to run --> |
---|
497 | <!-- * apply-templates on refpurpose here, instead of value-of --> |
---|
498 | <xsl:apply-templates select="refnamediv/refpurpose"/> |
---|
499 | </xsl:if> |
---|
500 | </span> |
---|
501 | </xsl:element> |
---|
502 | </xsl:template> |
---|
503 | |
---|
504 | <xsl:template match="title" mode="toc"> |
---|
505 | <xsl:param name="toc-context" select="."/> |
---|
506 | |
---|
507 | <a> |
---|
508 | <xsl:attribute name="href"> |
---|
509 | <xsl:call-template name="href.target"> |
---|
510 | <xsl:with-param name="object" select=".."/> |
---|
511 | <xsl:with-param name="toc-context" select="$toc-context"/> |
---|
512 | </xsl:call-template> |
---|
513 | </xsl:attribute> |
---|
514 | <xsl:apply-templates/> |
---|
515 | </a> |
---|
516 | </xsl:template> |
---|
517 | |
---|
518 | <xsl:template name="manual-toc"> |
---|
519 | <xsl:param name="toc-context" select="."/> |
---|
520 | <xsl:param name="tocentry"/> |
---|
521 | |
---|
522 | <!-- be careful, we don't want to change the current document to the other tree! --> |
---|
523 | |
---|
524 | <xsl:if test="$tocentry"> |
---|
525 | <xsl:variable name="node" select="key('id', $tocentry/@linkend)"/> |
---|
526 | |
---|
527 | <xsl:element name="{$toc.listitem.type}" namespace="http://www.w3.org/1999/xhtml"> |
---|
528 | <xsl:variable name="label"> |
---|
529 | <xsl:apply-templates select="$node" mode="label.markup"/> |
---|
530 | </xsl:variable> |
---|
531 | <xsl:copy-of select="$label"/> |
---|
532 | <xsl:if test="$label != ''"> |
---|
533 | <xsl:value-of select="$autotoc.label.separator"/> |
---|
534 | </xsl:if> |
---|
535 | <a> |
---|
536 | <xsl:attribute name="href"> |
---|
537 | <xsl:call-template name="href.target"> |
---|
538 | <xsl:with-param name="object" select="$node"/> |
---|
539 | <xsl:with-param name="toc-context" select="$toc-context"/> |
---|
540 | </xsl:call-template> |
---|
541 | </xsl:attribute> |
---|
542 | <xsl:apply-templates select="$node" mode="titleabbrev.markup"/> |
---|
543 | </a> |
---|
544 | </xsl:element> |
---|
545 | |
---|
546 | <xsl:if test="$tocentry/*"> |
---|
547 | <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml"> |
---|
548 | <xsl:call-template name="manual-toc"> |
---|
549 | <xsl:with-param name="tocentry" select="$tocentry/*[1]"/> |
---|
550 | </xsl:call-template> |
---|
551 | </xsl:element> |
---|
552 | </xsl:if> |
---|
553 | |
---|
554 | <xsl:if test="$tocentry/following-sibling::*"> |
---|
555 | <xsl:call-template name="manual-toc"> |
---|
556 | <xsl:with-param name="tocentry" select="$tocentry/following-sibling::*[1]"/> |
---|
557 | </xsl:call-template> |
---|
558 | </xsl:if> |
---|
559 | </xsl:if> |
---|
560 | </xsl:template> |
---|
561 | |
---|
562 | <!-- ==================================================================== --> |
---|
563 | |
---|
564 | <xsl:template name="list.of.titles"> |
---|
565 | <xsl:param name="toc-context" select="."/> |
---|
566 | <xsl:param name="titles" select="'table'"/> |
---|
567 | <xsl:param name="nodes" select=".//table"/> |
---|
568 | |
---|
569 | <xsl:if test="$nodes"> |
---|
570 | <div class="list-of-{$titles}s"> |
---|
571 | <p> |
---|
572 | <b> |
---|
573 | <xsl:call-template name="gentext"> |
---|
574 | <xsl:with-param name="key"> |
---|
575 | <xsl:choose> |
---|
576 | <xsl:when test="$titles='table'">ListofTables</xsl:when> |
---|
577 | <xsl:when test="$titles='figure'">ListofFigures</xsl:when> |
---|
578 | <xsl:when test="$titles='equation'">ListofEquations</xsl:when> |
---|
579 | <xsl:when test="$titles='example'">ListofExamples</xsl:when> |
---|
580 | <xsl:when test="$titles='procedure'">ListofProcedures</xsl:when> |
---|
581 | <xsl:otherwise>ListofUnknown</xsl:otherwise> |
---|
582 | </xsl:choose> |
---|
583 | </xsl:with-param> |
---|
584 | </xsl:call-template> |
---|
585 | </b> |
---|
586 | </p> |
---|
587 | |
---|
588 | <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml"> |
---|
589 | <xsl:apply-templates select="$nodes" mode="toc"> |
---|
590 | <xsl:with-param name="toc-context" select="$toc-context"/> |
---|
591 | </xsl:apply-templates> |
---|
592 | </xsl:element> |
---|
593 | </div> |
---|
594 | </xsl:if> |
---|
595 | </xsl:template> |
---|
596 | |
---|
597 | <xsl:template match="figure|table|example|equation|procedure" mode="toc"> |
---|
598 | <xsl:param name="toc-context" select="."/> |
---|
599 | |
---|
600 | <xsl:element name="{$toc.listitem.type}" namespace="http://www.w3.org/1999/xhtml"> |
---|
601 | <xsl:variable name="label"> |
---|
602 | <xsl:apply-templates select="." mode="label.markup"/> |
---|
603 | </xsl:variable> |
---|
604 | <xsl:copy-of select="$label"/> |
---|
605 | <xsl:if test="$label != ''"> |
---|
606 | <xsl:value-of select="$autotoc.label.separator"/> |
---|
607 | </xsl:if> |
---|
608 | <a> |
---|
609 | <xsl:attribute name="href"> |
---|
610 | <xsl:call-template name="href.target"> |
---|
611 | <xsl:with-param name="toc-context" select="$toc-context"/> |
---|
612 | </xsl:call-template> |
---|
613 | </xsl:attribute> |
---|
614 | <xsl:apply-templates select="." mode="titleabbrev.markup"/> |
---|
615 | </a> |
---|
616 | </xsl:element> |
---|
617 | </xsl:template> |
---|
618 | |
---|
619 | <!-- Used only if qanda.in.toc parameter is non-zero --> |
---|
620 | <xsl:template match="qandaset" mode="toc"> |
---|
621 | <xsl:param name="toc-context" select="."/> |
---|
622 | <xsl:call-template name="subtoc"> |
---|
623 | <xsl:with-param name="toc-context" select="$toc-context"/> |
---|
624 | <xsl:with-param name="nodes" select="qandadiv | qandaentry"/> |
---|
625 | </xsl:call-template> |
---|
626 | </xsl:template> |
---|
627 | |
---|
628 | <xsl:template match="qandadiv|qandaentry" mode="toc"> |
---|
629 | <xsl:apply-templates select="." mode="qandatoc.mode"/> |
---|
630 | </xsl:template> |
---|
631 | |
---|
632 | </xsl:stylesheet> |
---|