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