1 <?xml version="1.0" encoding="ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets.-->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
6 <!-- ********************************************************************
7 $Id: sections.xsl 8421 2009-05-04 07:49:49Z bobstayton $
8 ********************************************************************
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://docbook.sf.net/release/xsl/current/ for
12 copyright and other information.
14 ******************************************************************** -->
16 <!-- ==================================================================== -->
18 <xsl:template match="section">
19 <xsl:variable name="depth" select="count(ancestor::section)+1"/>
21 <xsl:call-template name="id.warning"/>
24 <xsl:call-template name="common.html.attributes">
25 <xsl:with-param name="inherit" select="1"/>
27 <xsl:call-template name="section.titlepage"/>
29 <xsl:variable name="toc.params">
30 <xsl:call-template name="find.path.params">
31 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
35 <xsl:if test="contains($toc.params, 'toc') 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')"/>
39 <xsl:call-template name="section.toc.separator"/>
41 <xsl:apply-templates/>
42 <xsl:call-template name="process.chunk.footnotes"/>
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 |ancestor::simplesect |ancestor::sect1 |ancestor::sect2 |ancestor::sect3 |ancestor::sect4 |ancestor::sect5)[last()]"/>
50 <xsl:variable name="renderas">
52 <xsl:when test="$section/@renderas = 'sect1'">1</xsl:when>
53 <xsl:when test="$section/@renderas = 'sect2'">2</xsl:when>
54 <xsl:when test="$section/@renderas = 'sect3'">3</xsl:when>
55 <xsl:when test="$section/@renderas = 'sect4'">4</xsl:when>
56 <xsl:when test="$section/@renderas = 'sect5'">5</xsl:when>
57 <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise>
61 <xsl:variable name="level">
63 <xsl:when test="$renderas != ''">
64 <xsl:value-of select="$renderas"/>
67 <xsl:call-template name="section.level">
68 <xsl:with-param name="node" select="$section"/>
74 <xsl:call-template name="section.heading">
75 <xsl:with-param name="section" select="$section"/>
76 <xsl:with-param name="level" select="$level"/>
77 <xsl:with-param name="title">
78 <xsl:apply-templates select="$section" mode="object.title.markup">
79 <xsl:with-param name="allow-anchors" select="1"/>
80 </xsl:apply-templates>
85 <xsl:template match="section/title |section/info/title |sectioninfo/title" mode="titlepage.mode" priority="2">
86 <xsl:call-template name="section.title"/>
89 <xsl:template match="sect1">
90 <xsl:call-template name="id.warning"/>
93 <xsl:call-template name="common.html.attributes">
94 <xsl:with-param name="inherit" select="1"/>
98 <xsl:when test="@renderas = 'sect2'">
99 <xsl:call-template name="sect2.titlepage"/>
101 <xsl:when test="@renderas = 'sect3'">
102 <xsl:call-template name="sect3.titlepage"/>
104 <xsl:when test="@renderas = 'sect4'">
105 <xsl:call-template name="sect4.titlepage"/>
107 <xsl:when test="@renderas = 'sect5'">
108 <xsl:call-template name="sect5.titlepage"/>
111 <xsl:call-template name="sect1.titlepage"/>
115 <xsl:variable name="toc.params">
116 <xsl:call-template name="find.path.params">
117 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
121 <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 1">
122 <xsl:call-template name="section.toc">
123 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
125 <xsl:call-template name="section.toc.separator"/>
127 <xsl:apply-templates/>
128 <xsl:call-template name="process.chunk.footnotes"/>
132 <xsl:template match="sect1/title |sect1/info/title |sect1info/title" mode="titlepage.mode" priority="2">
133 <xsl:call-template name="section.title"/>
136 <xsl:template match="sect2">
137 <xsl:call-template name="id.warning"/>
140 <xsl:call-template name="common.html.attributes">
141 <xsl:with-param name="inherit" select="1"/>
145 <xsl:when test="@renderas = 'sect1'">
146 <xsl:call-template name="sect1.titlepage"/>
148 <xsl:when test="@renderas = 'sect3'">
149 <xsl:call-template name="sect3.titlepage"/>
151 <xsl:when test="@renderas = 'sect4'">
152 <xsl:call-template name="sect4.titlepage"/>
154 <xsl:when test="@renderas = 'sect5'">
155 <xsl:call-template name="sect5.titlepage"/>
158 <xsl:call-template name="sect2.titlepage"/>
162 <xsl:variable name="toc.params">
163 <xsl:call-template name="find.path.params">
164 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
168 <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 2">
169 <xsl:call-template name="section.toc">
170 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
172 <xsl:call-template name="section.toc.separator"/>
174 <xsl:apply-templates/>
175 <xsl:call-template name="process.chunk.footnotes"/>
179 <xsl:template match="sect2/title |sect2/info/title |sect2info/title" mode="titlepage.mode" priority="2">
180 <xsl:call-template name="section.title"/>
183 <xsl:template match="sect3">
184 <xsl:call-template name="id.warning"/>
187 <xsl:call-template name="common.html.attributes">
188 <xsl:with-param name="inherit" select="1"/>
192 <xsl:when test="@renderas = 'sect1'">
193 <xsl:call-template name="sect1.titlepage"/>
195 <xsl:when test="@renderas = 'sect2'">
196 <xsl:call-template name="sect2.titlepage"/>
198 <xsl:when test="@renderas = 'sect4'">
199 <xsl:call-template name="sect4.titlepage"/>
201 <xsl:when test="@renderas = 'sect5'">
202 <xsl:call-template name="sect5.titlepage"/>
205 <xsl:call-template name="sect3.titlepage"/>
209 <xsl:variable name="toc.params">
210 <xsl:call-template name="find.path.params">
211 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
215 <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 3">
216 <xsl:call-template name="section.toc">
217 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
219 <xsl:call-template name="section.toc.separator"/>
221 <xsl:apply-templates/>
222 <xsl:call-template name="process.chunk.footnotes"/>
226 <xsl:template match="sect3/title |sect3/info/title |sect3info/title" mode="titlepage.mode" priority="2">
227 <xsl:call-template name="section.title"/>
230 <xsl:template match="sect4">
231 <xsl:call-template name="id.warning"/>
234 <xsl:call-template name="common.html.attributes">
235 <xsl:with-param name="inherit" select="1"/>
239 <xsl:when test="@renderas = 'sect1'">
240 <xsl:call-template name="sect1.titlepage"/>
242 <xsl:when test="@renderas = 'sect2'">
243 <xsl:call-template name="sect2.titlepage"/>
245 <xsl:when test="@renderas = 'sect3'">
246 <xsl:call-template name="sect3.titlepage"/>
248 <xsl:when test="@renderas = 'sect5'">
249 <xsl:call-template name="sect5.titlepage"/>
252 <xsl:call-template name="sect4.titlepage"/>
256 <xsl:variable name="toc.params">
257 <xsl:call-template name="find.path.params">
258 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
262 <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 4">
263 <xsl:call-template name="section.toc">
264 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
266 <xsl:call-template name="section.toc.separator"/>
268 <xsl:apply-templates/>
269 <xsl:call-template name="process.chunk.footnotes"/>
273 <xsl:template match="sect4/title |sect4/info/title |sect4info/title" mode="titlepage.mode" priority="2">
274 <xsl:call-template name="section.title"/>
277 <xsl:template match="sect5">
278 <xsl:call-template name="id.warning"/>
281 <xsl:call-template name="common.html.attributes">
282 <xsl:with-param name="inherit" select="1"/>
286 <xsl:when test="@renderas = 'sect1'">
287 <xsl:call-template name="sect1.titlepage"/>
289 <xsl:when test="@renderas = 'sect2'">
290 <xsl:call-template name="sect2.titlepage"/>
292 <xsl:when test="@renderas = 'sect3'">
293 <xsl:call-template name="sect3.titlepage"/>
295 <xsl:when test="@renderas = 'sect4'">
296 <xsl:call-template name="sect4.titlepage"/>
299 <xsl:call-template name="sect5.titlepage"/>
303 <xsl:variable name="toc.params">
304 <xsl:call-template name="find.path.params">
305 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
309 <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 5">
310 <xsl:call-template name="section.toc">
311 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
313 <xsl:call-template name="section.toc.separator"/>
315 <xsl:apply-templates/>
316 <xsl:call-template name="process.chunk.footnotes"/>
320 <xsl:template match="sect5/title |sect5/info/title |sect5info/title" mode="titlepage.mode" priority="2">
321 <xsl:call-template name="section.title"/>
324 <xsl:template match="simplesect">
325 <xsl:call-template name="id.warning"/>
328 <xsl:call-template name="common.html.attributes">
329 <xsl:with-param name="inherit" select="1"/>
332 <xsl:call-template name="simplesect.titlepage"/>
333 <xsl:apply-templates/>
337 <xsl:template match="simplesect/title|simplesect/info/title" mode="titlepage.mode" priority="2">
338 <xsl:call-template name="section.title"/>
341 <xsl:template match="section/title"/>
342 <xsl:template match="section/titleabbrev"/>
343 <xsl:template match="section/subtitle"/>
344 <xsl:template match="sectioninfo"/>
345 <xsl:template match="section/info"/>
347 <xsl:template match="sect1/title"/>
348 <xsl:template match="sect1/titleabbrev"/>
349 <xsl:template match="sect1/subtitle"/>
350 <xsl:template match="sect1info"/>
351 <xsl:template match="sect1/info"/>
353 <xsl:template match="sect2/title"/>
354 <xsl:template match="sect2/subtitle"/>
355 <xsl:template match="sect2/titleabbrev"/>
356 <xsl:template match="sect2info"/>
357 <xsl:template match="sect2/info"/>
359 <xsl:template match="sect3/title"/>
360 <xsl:template match="sect3/subtitle"/>
361 <xsl:template match="sect3/titleabbrev"/>
362 <xsl:template match="sect3info"/>
363 <xsl:template match="sect3/info"/>
365 <xsl:template match="sect4/title"/>
366 <xsl:template match="sect4/subtitle"/>
367 <xsl:template match="sect4/titleabbrev"/>
368 <xsl:template match="sect4info"/>
369 <xsl:template match="sect4/info"/>
371 <xsl:template match="sect5/title"/>
372 <xsl:template match="sect5/subtitle"/>
373 <xsl:template match="sect5/titleabbrev"/>
374 <xsl:template match="sect5info"/>
375 <xsl:template match="sect5/info"/>
377 <xsl:template match="simplesect/title"/>
378 <xsl:template match="simplesect/subtitle"/>
379 <xsl:template match="simplesect/titleabbrev"/>
380 <xsl:template match="simplesect/info"/>
382 <!-- ==================================================================== -->
384 <xsl:template name="section.heading">
385 <xsl:param name="section" select="."/>
386 <xsl:param name="level" select="1"/>
387 <xsl:param name="allow-anchors" select="1"/>
388 <xsl:param name="title"/>
389 <xsl:param name="class" select="'title'"/>
391 <xsl:variable name="id">
393 <!-- Make sure the subtitle doesn't get the same id as the title -->
394 <xsl:when test="self::subtitle">
395 <xsl:call-template name="object.id">
396 <xsl:with-param name="object" select="."/>
399 <!-- if title is in an *info wrapper, get the grandparent -->
400 <xsl:when test="contains(local-name(..), 'info')">
401 <xsl:call-template name="object.id">
402 <xsl:with-param name="object" select="../.."/>
406 <xsl:call-template name="object.id">
407 <xsl:with-param name="object" select=".."/>
413 <!-- HTML H level is one higher than section level -->
414 <xsl:variable name="hlevel">
416 <!-- highest valid HTML H level is H6; so anything nested deeper
417 than 5 levels down just becomes H6 -->
418 <xsl:when test="$level > 5">6</xsl:when>
420 <xsl:value-of select="$level + 1"/>
424 <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml">
425 <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
426 <xsl:if test="$css.decoration != '0'">
427 <xsl:if test="$hlevel<3">
428 <xsl:attribute name="style">clear: both</xsl:attribute>
431 <xsl:if test="$allow-anchors != 0 and $generate.id.attributes = 0">
432 <xsl:call-template name="anchor">
433 <xsl:with-param name="node" select="$section"/>
434 <xsl:with-param name="conditional" select="0"/>
437 <xsl:if test="$generate.id.attributes != 0 and not(local-name(.) = 'appendix')">
438 <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
440 <xsl:copy-of select="$title"/>
444 <!-- ==================================================================== -->
446 <xsl:template match="bridgehead">
447 <xsl:variable name="container" select="(ancestor::appendix |ancestor::article |ancestor::bibliography |ancestor::chapter |ancestor::glossary |ancestor::glossdiv |ancestor::index |ancestor::partintro |ancestor::preface |ancestor::refsect1 |ancestor::refsect2 |ancestor::refsect3 |ancestor::sect1 |ancestor::sect2 |ancestor::sect3 |ancestor::sect4 |ancestor::sect5 |ancestor::section |ancestor::setindex |ancestor::simplesect)[last()]"/>
449 <xsl:variable name="clevel">
451 <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>
452 <xsl:when test="local-name($container) = 'glossdiv'">
453 <xsl:value-of select="count(ancestor::glossdiv)+1"/>
455 <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'">
456 <xsl:variable name="slevel">
457 <xsl:call-template name="section.level">
458 <xsl:with-param name="node" select="$container"/>
461 <xsl:value-of select="$slevel + 1"/>
463 <xsl:otherwise>1</xsl:otherwise>
467 <!-- HTML H level is one higher than section level -->
468 <xsl:variable name="hlevel">
470 <xsl:when test="@renderas = 'sect1'">2</xsl:when>
471 <xsl:when test="@renderas = 'sect2'">3</xsl:when>
472 <xsl:when test="@renderas = 'sect3'">4</xsl:when>
473 <xsl:when test="@renderas = 'sect4'">5</xsl:when>
474 <xsl:when test="@renderas = 'sect5'">6</xsl:when>
476 <xsl:value-of select="$clevel + 1"/>
481 <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml">
482 <xsl:call-template name="anchor">
483 <xsl:with-param name="conditional" select="0"/>
485 <xsl:apply-templates/>
489 <xsl:template match="section/subtitle" mode="titlepage.mode" priority="2">
490 <xsl:call-template name="section.subtitle"/>
493 <xsl:template match="simplesect/subtitle" mode="titlepage.mode" priority="2">
494 <xsl:call-template name="section.subtitle"/>
497 <xsl:template match="sect1/subtitle" mode="titlepage.mode" priority="2">
498 <xsl:call-template name="section.subtitle"/>
501 <xsl:template match="sect2/subtitle" mode="titlepage.mode" priority="2">
502 <xsl:call-template name="section.subtitle"/>
505 <xsl:template match="sect3/subtitle" mode="titlepage.mode" priority="2">
506 <xsl:call-template name="section.subtitle"/>
509 <xsl:template match="sect4/subtitle" mode="titlepage.mode" priority="2">
510 <xsl:call-template name="section.subtitle"/>
513 <xsl:template match="sect5/subtitle" mode="titlepage.mode" priority="2">
514 <xsl:call-template name="section.subtitle"/>
517 <xsl:template name="section.subtitle">
518 <!-- the context node should be the subtitle of a section when called -->
519 <xsl:variable name="section" select="(ancestor::section |ancestor::simplesect |ancestor::sect1 |ancestor::sect2 |ancestor::sect3 |ancestor::sect4 |ancestor::sect5)[last()]"/>
521 <xsl:variable name="level">
522 <xsl:call-template name="section.level">
523 <xsl:with-param name="node" select="$section"/>
527 <xsl:call-template name="section.heading">
528 <xsl:with-param name="section" select=".."/>
529 <xsl:with-param name="allow-anchors" select="0"/>
530 <!-- subtitle heading level one higher than section level -->
531 <xsl:with-param name="level" select="$level + 1"/>
532 <xsl:with-param name="class" select="'subtitle'"/>
533 <xsl:with-param name="title">
534 <xsl:apply-templates select="$section" mode="object.subtitle.markup">
535 <xsl:with-param name="allow-anchors" select="0"/>
536 </xsl:apply-templates>