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