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