1 | <?xml version='1.0'?> |
---|
2 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
---|
3 | version='1.0'> |
---|
4 | |
---|
5 | <!-- ******************************************************************** |
---|
6 | $Id: sections.xsl 6434 2006-11-18 09:00:48Z bobstayton $ |
---|
7 | ******************************************************************** |
---|
8 | |
---|
9 | This file is part of the XSL DocBook Stylesheet distribution. |
---|
10 | See ../README or http://nwalsh.com/docbook/xsl/ for copyright |
---|
11 | and other information. |
---|
12 | |
---|
13 | ******************************************************************** --> |
---|
14 | |
---|
15 | <!-- ==================================================================== --> |
---|
16 | |
---|
17 | <xsl:template match="section"> |
---|
18 | <xsl:variable name="depth" select="count(ancestor::section)+1"/> |
---|
19 | |
---|
20 | <xsl:call-template name="id.warning"/> |
---|
21 | |
---|
22 | <div> |
---|
23 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
24 | <xsl:call-template name="dir"> |
---|
25 | <xsl:with-param name="inherit" select="1"/> |
---|
26 | </xsl:call-template> |
---|
27 | <xsl:call-template name="language.attribute"/> |
---|
28 | <xsl:call-template name="section.titlepage"/> |
---|
29 | |
---|
30 | <xsl:variable name="toc.params"> |
---|
31 | <xsl:call-template name="find.path.params"> |
---|
32 | <xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
---|
33 | </xsl:call-template> |
---|
34 | </xsl:variable> |
---|
35 | |
---|
36 | <xsl:if test="contains($toc.params, 'toc') |
---|
37 | and $depth <= $generate.section.toc.level"> |
---|
38 | <xsl:call-template name="section.toc"> |
---|
39 | <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> |
---|
40 | </xsl:call-template> |
---|
41 | <xsl:call-template name="section.toc.separator"/> |
---|
42 | </xsl:if> |
---|
43 | <xsl:apply-templates/> |
---|
44 | <xsl:call-template name="process.chunk.footnotes"/> |
---|
45 | </div> |
---|
46 | </xsl:template> |
---|
47 | |
---|
48 | <xsl:template name="section.title"> |
---|
49 | <!-- the context node should be the title of a section when called --> |
---|
50 | <xsl:variable name="section" select="(ancestor::section |
---|
51 | |ancestor::simplesect |
---|
52 | |ancestor::sect1 |
---|
53 | |ancestor::sect2 |
---|
54 | |ancestor::sect3 |
---|
55 | |ancestor::sect4 |
---|
56 | |ancestor::sect5)[last()]"/> |
---|
57 | |
---|
58 | <xsl:variable name="renderas"> |
---|
59 | <xsl:choose> |
---|
60 | <xsl:when test="$section/@renderas = 'sect1'">1</xsl:when> |
---|
61 | <xsl:when test="$section/@renderas = 'sect2'">2</xsl:when> |
---|
62 | <xsl:when test="$section/@renderas = 'sect3'">3</xsl:when> |
---|
63 | <xsl:when test="$section/@renderas = 'sect4'">4</xsl:when> |
---|
64 | <xsl:when test="$section/@renderas = 'sect5'">5</xsl:when> |
---|
65 | <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise> |
---|
66 | </xsl:choose> |
---|
67 | </xsl:variable> |
---|
68 | |
---|
69 | <xsl:variable name="level"> |
---|
70 | <xsl:choose> |
---|
71 | <xsl:when test="$renderas != ''"> |
---|
72 | <xsl:value-of select="$renderas"/> |
---|
73 | </xsl:when> |
---|
74 | <xsl:otherwise> |
---|
75 | <xsl:call-template name="section.level"> |
---|
76 | <xsl:with-param name="node" select="$section"/> |
---|
77 | </xsl:call-template> |
---|
78 | </xsl:otherwise> |
---|
79 | </xsl:choose> |
---|
80 | </xsl:variable> |
---|
81 | |
---|
82 | <xsl:call-template name="section.heading"> |
---|
83 | <xsl:with-param name="section" select="$section"/> |
---|
84 | <xsl:with-param name="level" select="$level"/> |
---|
85 | <xsl:with-param name="title"> |
---|
86 | <xsl:apply-templates select="$section" mode="object.title.markup"> |
---|
87 | <xsl:with-param name="allow-anchors" select="1"/> |
---|
88 | </xsl:apply-templates> |
---|
89 | </xsl:with-param> |
---|
90 | </xsl:call-template> |
---|
91 | </xsl:template> |
---|
92 | |
---|
93 | <xsl:template match="section/title |
---|
94 | |section/info/title |
---|
95 | |sectioninfo/title" |
---|
96 | mode="titlepage.mode" priority="2"> |
---|
97 | <xsl:call-template name="section.title"/> |
---|
98 | </xsl:template> |
---|
99 | |
---|
100 | <xsl:template match="sect1"> |
---|
101 | <xsl:call-template name="id.warning"/> |
---|
102 | |
---|
103 | <div> |
---|
104 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
105 | <xsl:call-template name="dir"> |
---|
106 | <xsl:with-param name="inherit" select="1"/> |
---|
107 | </xsl:call-template> |
---|
108 | <xsl:call-template name="language.attribute"/> |
---|
109 | |
---|
110 | <xsl:choose> |
---|
111 | <xsl:when test="@renderas = 'sect2'"> |
---|
112 | <xsl:call-template name="sect2.titlepage"/> |
---|
113 | </xsl:when> |
---|
114 | <xsl:when test="@renderas = 'sect3'"> |
---|
115 | <xsl:call-template name="sect3.titlepage"/> |
---|
116 | </xsl:when> |
---|
117 | <xsl:when test="@renderas = 'sect4'"> |
---|
118 | <xsl:call-template name="sect4.titlepage"/> |
---|
119 | </xsl:when> |
---|
120 | <xsl:when test="@renderas = 'sect5'"> |
---|
121 | <xsl:call-template name="sect5.titlepage"/> |
---|
122 | </xsl:when> |
---|
123 | <xsl:otherwise> |
---|
124 | <xsl:call-template name="sect1.titlepage"/> |
---|
125 | </xsl:otherwise> |
---|
126 | </xsl:choose> |
---|
127 | |
---|
128 | <xsl:variable name="toc.params"> |
---|
129 | <xsl:call-template name="find.path.params"> |
---|
130 | <xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
---|
131 | </xsl:call-template> |
---|
132 | </xsl:variable> |
---|
133 | |
---|
134 | <xsl:if test="contains($toc.params, 'toc') |
---|
135 | and $generate.section.toc.level >= 1 and ../@chunked = '1'"> |
---|
136 | <xsl:call-template name="section.toc"> |
---|
137 | <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> |
---|
138 | </xsl:call-template> |
---|
139 | <xsl:call-template name="section.toc.separator"/> |
---|
140 | </xsl:if> |
---|
141 | <xsl:apply-templates/> |
---|
142 | <xsl:call-template name="process.chunk.footnotes"/> |
---|
143 | </div> |
---|
144 | </xsl:template> |
---|
145 | |
---|
146 | <xsl:template match="sect1/title |
---|
147 | |sect1/info/title |
---|
148 | |sect1info/title" |
---|
149 | mode="titlepage.mode" priority="2"> |
---|
150 | <xsl:call-template name="section.title"/> |
---|
151 | </xsl:template> |
---|
152 | |
---|
153 | <xsl:template match="sect2"> |
---|
154 | <xsl:call-template name="id.warning"/> |
---|
155 | |
---|
156 | <div> |
---|
157 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
158 | <xsl:call-template name="dir"> |
---|
159 | <xsl:with-param name="inherit" select="1"/> |
---|
160 | </xsl:call-template> |
---|
161 | <xsl:call-template name="language.attribute"/> |
---|
162 | |
---|
163 | <xsl:choose> |
---|
164 | <xsl:when test="@renderas = 'sect1'"> |
---|
165 | <xsl:call-template name="sect1.titlepage"/> |
---|
166 | </xsl:when> |
---|
167 | <xsl:when test="@renderas = 'sect3'"> |
---|
168 | <xsl:call-template name="sect3.titlepage"/> |
---|
169 | </xsl:when> |
---|
170 | <xsl:when test="@renderas = 'sect4'"> |
---|
171 | <xsl:call-template name="sect4.titlepage"/> |
---|
172 | </xsl:when> |
---|
173 | <xsl:when test="@renderas = 'sect5'"> |
---|
174 | <xsl:call-template name="sect5.titlepage"/> |
---|
175 | </xsl:when> |
---|
176 | <xsl:otherwise> |
---|
177 | <xsl:call-template name="sect2.titlepage"/> |
---|
178 | </xsl:otherwise> |
---|
179 | </xsl:choose> |
---|
180 | |
---|
181 | <xsl:variable name="toc.params"> |
---|
182 | <xsl:call-template name="find.path.params"> |
---|
183 | <xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
---|
184 | </xsl:call-template> |
---|
185 | </xsl:variable> |
---|
186 | |
---|
187 | <xsl:if test="contains($toc.params, 'toc') |
---|
188 | and $generate.section.toc.level >= 2"> |
---|
189 | <xsl:call-template name="section.toc"> |
---|
190 | <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> |
---|
191 | </xsl:call-template> |
---|
192 | <xsl:call-template name="section.toc.separator"/> |
---|
193 | </xsl:if> |
---|
194 | <xsl:apply-templates/> |
---|
195 | <xsl:call-template name="process.chunk.footnotes"/> |
---|
196 | </div> |
---|
197 | </xsl:template> |
---|
198 | |
---|
199 | <xsl:template match="sect2/title |
---|
200 | |sect2/info/title |
---|
201 | |sect2info/title" |
---|
202 | mode="titlepage.mode" priority="2"> |
---|
203 | <xsl:call-template name="section.title"/> |
---|
204 | </xsl:template> |
---|
205 | |
---|
206 | <xsl:template match="sect3"> |
---|
207 | <xsl:call-template name="id.warning"/> |
---|
208 | |
---|
209 | <div> |
---|
210 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
211 | <xsl:call-template name="dir"> |
---|
212 | <xsl:with-param name="inherit" select="1"/> |
---|
213 | </xsl:call-template> |
---|
214 | <xsl:call-template name="language.attribute"/> |
---|
215 | |
---|
216 | <xsl:choose> |
---|
217 | <xsl:when test="@renderas = 'sect1'"> |
---|
218 | <xsl:call-template name="sect1.titlepage"/> |
---|
219 | </xsl:when> |
---|
220 | <xsl:when test="@renderas = 'sect2'"> |
---|
221 | <xsl:call-template name="sect2.titlepage"/> |
---|
222 | </xsl:when> |
---|
223 | <xsl:when test="@renderas = 'sect4'"> |
---|
224 | <xsl:call-template name="sect4.titlepage"/> |
---|
225 | </xsl:when> |
---|
226 | <xsl:when test="@renderas = 'sect5'"> |
---|
227 | <xsl:call-template name="sect5.titlepage"/> |
---|
228 | </xsl:when> |
---|
229 | <xsl:otherwise> |
---|
230 | <xsl:call-template name="sect3.titlepage"/> |
---|
231 | </xsl:otherwise> |
---|
232 | </xsl:choose> |
---|
233 | |
---|
234 | <xsl:variable name="toc.params"> |
---|
235 | <xsl:call-template name="find.path.params"> |
---|
236 | <xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
---|
237 | </xsl:call-template> |
---|
238 | </xsl:variable> |
---|
239 | |
---|
240 | <xsl:if test="contains($toc.params, 'toc') |
---|
241 | and $generate.section.toc.level >= 3"> |
---|
242 | <xsl:call-template name="section.toc"> |
---|
243 | <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> |
---|
244 | </xsl:call-template> |
---|
245 | <xsl:call-template name="section.toc.separator"/> |
---|
246 | </xsl:if> |
---|
247 | <xsl:apply-templates/> |
---|
248 | <xsl:call-template name="process.chunk.footnotes"/> |
---|
249 | </div> |
---|
250 | </xsl:template> |
---|
251 | |
---|
252 | <xsl:template match="sect3/title |
---|
253 | |sect3/info/title |
---|
254 | |sect3info/title" |
---|
255 | mode="titlepage.mode" priority="2"> |
---|
256 | <xsl:call-template name="section.title"/> |
---|
257 | </xsl:template> |
---|
258 | |
---|
259 | <xsl:template match="sect4"> |
---|
260 | <xsl:call-template name="id.warning"/> |
---|
261 | |
---|
262 | <div> |
---|
263 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
264 | <xsl:call-template name="dir"> |
---|
265 | <xsl:with-param name="inherit" select="1"/> |
---|
266 | </xsl:call-template> |
---|
267 | <xsl:call-template name="language.attribute"/> |
---|
268 | |
---|
269 | <xsl:choose> |
---|
270 | <xsl:when test="@renderas = 'sect1'"> |
---|
271 | <xsl:call-template name="sect1.titlepage"/> |
---|
272 | </xsl:when> |
---|
273 | <xsl:when test="@renderas = 'sect2'"> |
---|
274 | <xsl:call-template name="sect2.titlepage"/> |
---|
275 | </xsl:when> |
---|
276 | <xsl:when test="@renderas = 'sect3'"> |
---|
277 | <xsl:call-template name="sect3.titlepage"/> |
---|
278 | </xsl:when> |
---|
279 | <xsl:when test="@renderas = 'sect5'"> |
---|
280 | <xsl:call-template name="sect5.titlepage"/> |
---|
281 | </xsl:when> |
---|
282 | <xsl:otherwise> |
---|
283 | <xsl:call-template name="sect4.titlepage"/> |
---|
284 | </xsl:otherwise> |
---|
285 | </xsl:choose> |
---|
286 | |
---|
287 | <xsl:variable name="toc.params"> |
---|
288 | <xsl:call-template name="find.path.params"> |
---|
289 | <xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
---|
290 | </xsl:call-template> |
---|
291 | </xsl:variable> |
---|
292 | |
---|
293 | <xsl:if test="contains($toc.params, 'toc') |
---|
294 | and $generate.section.toc.level >= 4"> |
---|
295 | <xsl:call-template name="section.toc"> |
---|
296 | <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> |
---|
297 | </xsl:call-template> |
---|
298 | <xsl:call-template name="section.toc.separator"/> |
---|
299 | </xsl:if> |
---|
300 | <xsl:apply-templates/> |
---|
301 | <xsl:call-template name="process.chunk.footnotes"/> |
---|
302 | </div> |
---|
303 | </xsl:template> |
---|
304 | |
---|
305 | <xsl:template match="sect4/title |
---|
306 | |sect4/info/title |
---|
307 | |sect4info/title" |
---|
308 | mode="titlepage.mode" priority="2"> |
---|
309 | <xsl:call-template name="section.title"/> |
---|
310 | </xsl:template> |
---|
311 | |
---|
312 | <xsl:template match="sect5"> |
---|
313 | <xsl:call-template name="id.warning"/> |
---|
314 | |
---|
315 | <div> |
---|
316 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
317 | <xsl:call-template name="dir"> |
---|
318 | <xsl:with-param name="inherit" select="1"/> |
---|
319 | </xsl:call-template> |
---|
320 | <xsl:call-template name="language.attribute"/> |
---|
321 | |
---|
322 | <xsl:choose> |
---|
323 | <xsl:when test="@renderas = 'sect1'"> |
---|
324 | <xsl:call-template name="sect1.titlepage"/> |
---|
325 | </xsl:when> |
---|
326 | <xsl:when test="@renderas = 'sect2'"> |
---|
327 | <xsl:call-template name="sect2.titlepage"/> |
---|
328 | </xsl:when> |
---|
329 | <xsl:when test="@renderas = 'sect3'"> |
---|
330 | <xsl:call-template name="sect3.titlepage"/> |
---|
331 | </xsl:when> |
---|
332 | <xsl:when test="@renderas = 'sect4'"> |
---|
333 | <xsl:call-template name="sect4.titlepage"/> |
---|
334 | </xsl:when> |
---|
335 | <xsl:otherwise> |
---|
336 | <xsl:call-template name="sect5.titlepage"/> |
---|
337 | </xsl:otherwise> |
---|
338 | </xsl:choose> |
---|
339 | |
---|
340 | <xsl:variable name="toc.params"> |
---|
341 | <xsl:call-template name="find.path.params"> |
---|
342 | <xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
---|
343 | </xsl:call-template> |
---|
344 | </xsl:variable> |
---|
345 | |
---|
346 | <xsl:if test="contains($toc.params, 'toc') |
---|
347 | and $generate.section.toc.level >= 5"> |
---|
348 | <xsl:call-template name="section.toc"> |
---|
349 | <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> |
---|
350 | </xsl:call-template> |
---|
351 | <xsl:call-template name="section.toc.separator"/> |
---|
352 | </xsl:if> |
---|
353 | <xsl:apply-templates/> |
---|
354 | <xsl:call-template name="process.chunk.footnotes"/> |
---|
355 | </div> |
---|
356 | </xsl:template> |
---|
357 | |
---|
358 | <xsl:template match="sect5/title |
---|
359 | |sect5/info/title |
---|
360 | |sect5info/title" |
---|
361 | mode="titlepage.mode" priority="2"> |
---|
362 | <xsl:call-template name="section.title"/> |
---|
363 | </xsl:template> |
---|
364 | |
---|
365 | <xsl:template match="simplesect"> |
---|
366 | <xsl:call-template name="id.warning"/> |
---|
367 | |
---|
368 | <div> |
---|
369 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
370 | <xsl:call-template name="dir"> |
---|
371 | <xsl:with-param name="inherit" select="1"/> |
---|
372 | </xsl:call-template> |
---|
373 | <xsl:call-template name="language.attribute"/> |
---|
374 | <xsl:call-template name="simplesect.titlepage"/> |
---|
375 | <xsl:apply-templates/> |
---|
376 | </div> |
---|
377 | </xsl:template> |
---|
378 | |
---|
379 | <xsl:template match="simplesect/title|simplesect/info/title" |
---|
380 | mode="titlepage.mode" priority="2"> |
---|
381 | <xsl:call-template name="section.title"/> |
---|
382 | </xsl:template> |
---|
383 | |
---|
384 | <xsl:template match="section/title"></xsl:template> |
---|
385 | <xsl:template match="section/titleabbrev"></xsl:template> |
---|
386 | <xsl:template match="section/subtitle"></xsl:template> |
---|
387 | <xsl:template match="sectioninfo"></xsl:template> |
---|
388 | <xsl:template match="section/info"></xsl:template> |
---|
389 | |
---|
390 | <xsl:template match="sect1/title"></xsl:template> |
---|
391 | <xsl:template match="sect1/titleabbrev"></xsl:template> |
---|
392 | <xsl:template match="sect1/subtitle"></xsl:template> |
---|
393 | <xsl:template match="sect1info"></xsl:template> |
---|
394 | <xsl:template match="sect1/info"></xsl:template> |
---|
395 | |
---|
396 | <xsl:template match="sect2/title"></xsl:template> |
---|
397 | <xsl:template match="sect2/subtitle"></xsl:template> |
---|
398 | <xsl:template match="sect2/titleabbrev"></xsl:template> |
---|
399 | <xsl:template match="sect2info"></xsl:template> |
---|
400 | <xsl:template match="sect2/info"></xsl:template> |
---|
401 | |
---|
402 | <xsl:template match="sect3/title"></xsl:template> |
---|
403 | <xsl:template match="sect3/subtitle"></xsl:template> |
---|
404 | <xsl:template match="sect3/titleabbrev"></xsl:template> |
---|
405 | <xsl:template match="sect3info"></xsl:template> |
---|
406 | <xsl:template match="sect3/info"></xsl:template> |
---|
407 | |
---|
408 | <xsl:template match="sect4/title"></xsl:template> |
---|
409 | <xsl:template match="sect4/subtitle"></xsl:template> |
---|
410 | <xsl:template match="sect4/titleabbrev"></xsl:template> |
---|
411 | <xsl:template match="sect4info"></xsl:template> |
---|
412 | <xsl:template match="sect4/info"></xsl:template> |
---|
413 | |
---|
414 | <xsl:template match="sect5/title"></xsl:template> |
---|
415 | <xsl:template match="sect5/subtitle"></xsl:template> |
---|
416 | <xsl:template match="sect5/titleabbrev"></xsl:template> |
---|
417 | <xsl:template match="sect5info"></xsl:template> |
---|
418 | <xsl:template match="sect5/info"></xsl:template> |
---|
419 | |
---|
420 | <xsl:template match="simplesect/title"></xsl:template> |
---|
421 | <xsl:template match="simplesect/subtitle"></xsl:template> |
---|
422 | <xsl:template match="simplesect/titleabbrev"></xsl:template> |
---|
423 | <xsl:template match="simplesect/info"></xsl:template> |
---|
424 | |
---|
425 | <!-- ==================================================================== --> |
---|
426 | |
---|
427 | <xsl:template name="section.heading"> |
---|
428 | <xsl:param name="section" select="."/> |
---|
429 | <xsl:param name="level" select="1"/> |
---|
430 | <xsl:param name="allow-anchors" select="1"/> |
---|
431 | <xsl:param name="title"/> |
---|
432 | <xsl:param name="class" select="'title'"/> |
---|
433 | |
---|
434 | <xsl:variable name="id"> |
---|
435 | <xsl:choose> |
---|
436 | <!-- if title is in an *info wrapper, get the grandparent --> |
---|
437 | <xsl:when test="contains(local-name(..), 'info')"> |
---|
438 | <xsl:call-template name="object.id"> |
---|
439 | <xsl:with-param name="object" select="../.."/> |
---|
440 | </xsl:call-template> |
---|
441 | </xsl:when> |
---|
442 | <xsl:otherwise> |
---|
443 | <xsl:call-template name="object.id"> |
---|
444 | <xsl:with-param name="object" select=".."/> |
---|
445 | </xsl:call-template> |
---|
446 | </xsl:otherwise> |
---|
447 | </xsl:choose> |
---|
448 | </xsl:variable> |
---|
449 | |
---|
450 | <!-- HTML H level is one higher than section level --> |
---|
451 | <xsl:variable name="hlevel"> |
---|
452 | <xsl:choose> |
---|
453 | <!-- highest valid HTML H level is H6; so anything nested deeper |
---|
454 | than 5 levels down just becomes H6 --> |
---|
455 | <xsl:when test="$level > 5">6</xsl:when> |
---|
456 | <xsl:otherwise> |
---|
457 | <xsl:value-of select="$level + 1"/> |
---|
458 | </xsl:otherwise> |
---|
459 | </xsl:choose> |
---|
460 | </xsl:variable> |
---|
461 | <xsl:element name="h{$hlevel}"> |
---|
462 | <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute> |
---|
463 | <xsl:if test="$css.decoration != '0'"> |
---|
464 | <xsl:if test="$hlevel<3"> |
---|
465 | <xsl:attribute name="style">clear: both</xsl:attribute> |
---|
466 | </xsl:if> |
---|
467 | </xsl:if> |
---|
468 | <xsl:if test="$allow-anchors != 0"> |
---|
469 | <xsl:call-template name="anchor"> |
---|
470 | <xsl:with-param name="node" select="$section"/> |
---|
471 | <xsl:with-param name="conditional" select="0"/> |
---|
472 | </xsl:call-template> |
---|
473 | </xsl:if> |
---|
474 | <xsl:copy-of select="$title"/> |
---|
475 | </xsl:element> |
---|
476 | </xsl:template> |
---|
477 | |
---|
478 | <!-- ==================================================================== --> |
---|
479 | |
---|
480 | <xsl:template match="bridgehead"> |
---|
481 | <xsl:variable name="container" |
---|
482 | select="(ancestor::appendix |
---|
483 | |ancestor::article |
---|
484 | |ancestor::bibliography |
---|
485 | |ancestor::chapter |
---|
486 | |ancestor::glossary |
---|
487 | |ancestor::glossdiv |
---|
488 | |ancestor::index |
---|
489 | |ancestor::partintro |
---|
490 | |ancestor::preface |
---|
491 | |ancestor::refsect1 |
---|
492 | |ancestor::refsect2 |
---|
493 | |ancestor::refsect3 |
---|
494 | |ancestor::sect1 |
---|
495 | |ancestor::sect2 |
---|
496 | |ancestor::sect3 |
---|
497 | |ancestor::sect4 |
---|
498 | |ancestor::sect5 |
---|
499 | |ancestor::section |
---|
500 | |ancestor::setindex |
---|
501 | |ancestor::simplesect)[last()]"/> |
---|
502 | |
---|
503 | <xsl:variable name="clevel"> |
---|
504 | <xsl:choose> |
---|
505 | <xsl:when test="local-name($container) = 'appendix' |
---|
506 | or local-name($container) = 'chapter' |
---|
507 | or local-name($container) = 'article' |
---|
508 | or local-name($container) = 'bibliography' |
---|
509 | or local-name($container) = 'glossary' |
---|
510 | or local-name($container) = 'index' |
---|
511 | or local-name($container) = 'partintro' |
---|
512 | or local-name($container) = 'preface' |
---|
513 | or local-name($container) = 'setindex'">1</xsl:when> |
---|
514 | <xsl:when test="local-name($container) = 'glossdiv'"> |
---|
515 | <xsl:value-of select="count(ancestor::glossdiv)+1"/> |
---|
516 | </xsl:when> |
---|
517 | <xsl:when test="local-name($container) = 'sect1' |
---|
518 | or local-name($container) = 'sect2' |
---|
519 | or local-name($container) = 'sect3' |
---|
520 | or local-name($container) = 'sect4' |
---|
521 | or local-name($container) = 'sect5' |
---|
522 | or local-name($container) = 'refsect1' |
---|
523 | or local-name($container) = 'refsect2' |
---|
524 | or local-name($container) = 'refsect3' |
---|
525 | or local-name($container) = 'section' |
---|
526 | or local-name($container) = 'simplesect'"> |
---|
527 | <xsl:variable name="slevel"> |
---|
528 | <xsl:call-template name="section.level"> |
---|
529 | <xsl:with-param name="node" select="$container"/> |
---|
530 | </xsl:call-template> |
---|
531 | </xsl:variable> |
---|
532 | <xsl:value-of select="$slevel + 1"/> |
---|
533 | </xsl:when> |
---|
534 | <xsl:otherwise>1</xsl:otherwise> |
---|
535 | </xsl:choose> |
---|
536 | </xsl:variable> |
---|
537 | |
---|
538 | <!-- HTML H level is one higher than section level --> |
---|
539 | <xsl:variable name="hlevel"> |
---|
540 | <xsl:choose> |
---|
541 | <xsl:when test="@renderas = 'sect1'">2</xsl:when> |
---|
542 | <xsl:when test="@renderas = 'sect2'">3</xsl:when> |
---|
543 | <xsl:when test="@renderas = 'sect3'">4</xsl:when> |
---|
544 | <xsl:when test="@renderas = 'sect4'">5</xsl:when> |
---|
545 | <xsl:when test="@renderas = 'sect5'">6</xsl:when> |
---|
546 | <xsl:otherwise> |
---|
547 | <xsl:value-of select="$clevel + 1"/> |
---|
548 | </xsl:otherwise> |
---|
549 | </xsl:choose> |
---|
550 | </xsl:variable> |
---|
551 | |
---|
552 | <xsl:element name="h{$hlevel}"> |
---|
553 | <xsl:call-template name="anchor"> |
---|
554 | <xsl:with-param name="conditional" select="0"/> |
---|
555 | </xsl:call-template> |
---|
556 | <xsl:apply-templates/> |
---|
557 | </xsl:element> |
---|
558 | </xsl:template> |
---|
559 | |
---|
560 | <xsl:template match="section/subtitle" mode="titlepage.mode" priority="2"> |
---|
561 | <xsl:call-template name="section.subtitle"/> |
---|
562 | </xsl:template> |
---|
563 | |
---|
564 | <xsl:template match="simplesect/subtitle" mode="titlepage.mode" priority="2"> |
---|
565 | <xsl:call-template name="section.subtitle"/> |
---|
566 | </xsl:template> |
---|
567 | |
---|
568 | <xsl:template match="sect1/subtitle" mode="titlepage.mode" priority="2"> |
---|
569 | <xsl:call-template name="section.subtitle"/> |
---|
570 | </xsl:template> |
---|
571 | |
---|
572 | <xsl:template match="sect2/subtitle" mode="titlepage.mode" priority="2"> |
---|
573 | <xsl:call-template name="section.subtitle"/> |
---|
574 | </xsl:template> |
---|
575 | |
---|
576 | <xsl:template match="sect3/subtitle" mode="titlepage.mode" priority="2"> |
---|
577 | <xsl:call-template name="section.subtitle"/> |
---|
578 | </xsl:template> |
---|
579 | |
---|
580 | <xsl:template match="sect4/subtitle" mode="titlepage.mode" priority="2"> |
---|
581 | <xsl:call-template name="section.subtitle"/> |
---|
582 | </xsl:template> |
---|
583 | |
---|
584 | <xsl:template match="sect5/subtitle" mode="titlepage.mode" priority="2"> |
---|
585 | <xsl:call-template name="section.subtitle"/> |
---|
586 | </xsl:template> |
---|
587 | |
---|
588 | <xsl:template name="section.subtitle"> |
---|
589 | <!-- the context node should be the subtitle of a section when called --> |
---|
590 | <xsl:variable name="section" select="(ancestor::section |
---|
591 | |ancestor::simplesect |
---|
592 | |ancestor::sect1 |
---|
593 | |ancestor::sect2 |
---|
594 | |ancestor::sect3 |
---|
595 | |ancestor::sect4 |
---|
596 | |ancestor::sect5)[last()]"/> |
---|
597 | |
---|
598 | <xsl:variable name="level"> |
---|
599 | <xsl:call-template name="section.level"> |
---|
600 | <xsl:with-param name="node" select="$section"/> |
---|
601 | </xsl:call-template> |
---|
602 | </xsl:variable> |
---|
603 | |
---|
604 | <xsl:call-template name="section.heading"> |
---|
605 | <xsl:with-param name="section" select=".."/> |
---|
606 | <xsl:with-param name="allow-anchors" select="0"/> |
---|
607 | <!-- subtitle heading level one higher than section level --> |
---|
608 | <xsl:with-param name="level" select="$level + 1"/> |
---|
609 | <xsl:with-param name="class" select="'subtitle'"/> |
---|
610 | <xsl:with-param name="title"> |
---|
611 | <xsl:apply-templates select="$section" mode="object.subtitle.markup"> |
---|
612 | <xsl:with-param name="allow-anchors" select="0"/> |
---|
613 | </xsl:apply-templates> |
---|
614 | </xsl:with-param> |
---|
615 | </xsl:call-template> |
---|
616 | </xsl:template> |
---|
617 | |
---|
618 | </xsl:stylesheet> |
---|
619 | |
---|