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