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 9392 2012-06-02 20:10:58Z 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"/>
23 <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml">
24 <xsl:call-template name="common.html.attributes">
25 <xsl:with-param name="inherit" select="1"/>
27 <xsl:call-template name="id.attribute">
28 <xsl:with-param name="conditional" select="0"/>
30 <xsl:call-template name="section.titlepage"/>
32 <xsl:variable name="toc.params">
33 <xsl:call-template name="find.path.params">
34 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
38 <xsl:if test="contains($toc.params, 'toc') 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')"/>
42 <xsl:call-template name="section.toc.separator"/>
44 <xsl:apply-templates/>
45 <xsl:call-template name="process.chunk.footnotes"/>
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 |ancestor::simplesect |ancestor::sect1 |ancestor::sect2 |ancestor::sect3 |ancestor::sect4 |ancestor::sect5)[last()]"/>
53 <xsl:variable name="renderas">
55 <xsl:when test="$section/@renderas = 'sect1'">1</xsl:when>
56 <xsl:when test="$section/@renderas = 'sect2'">2</xsl:when>
57 <xsl:when test="$section/@renderas = 'sect3'">3</xsl:when>
58 <xsl:when test="$section/@renderas = 'sect4'">4</xsl:when>
59 <xsl:when test="$section/@renderas = 'sect5'">5</xsl:when>
60 <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise>
64 <xsl:variable name="level">
66 <xsl:when test="$renderas != ''">
67 <xsl:value-of select="$renderas"/>
70 <xsl:call-template name="section.level">
71 <xsl:with-param name="node" select="$section"/>
77 <xsl:call-template name="section.heading">
78 <xsl:with-param name="section" select="$section"/>
79 <xsl:with-param name="level" select="$level"/>
80 <xsl:with-param name="title">
81 <xsl:apply-templates select="$section" mode="object.title.markup">
82 <xsl:with-param name="allow-anchors" select="1"/>
83 </xsl:apply-templates>
88 <xsl:template match="section/title |section/info/title |sectioninfo/title" mode="titlepage.mode" priority="2">
89 <xsl:call-template name="section.title"/>
92 <xsl:template match="sect1">
93 <xsl:call-template name="id.warning"/>
95 <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml">
96 <xsl:call-template name="common.html.attributes">
97 <xsl:with-param name="inherit" select="1"/>
99 <xsl:call-template name="id.attribute">
100 <xsl:with-param name="conditional" select="0"/>
104 <xsl:when test="@renderas = 'sect2'">
105 <xsl:call-template name="sect2.titlepage"/>
107 <xsl:when test="@renderas = 'sect3'">
108 <xsl:call-template name="sect3.titlepage"/>
110 <xsl:when test="@renderas = 'sect4'">
111 <xsl:call-template name="sect4.titlepage"/>
113 <xsl:when test="@renderas = 'sect5'">
114 <xsl:call-template name="sect5.titlepage"/>
117 <xsl:call-template name="sect1.titlepage"/>
121 <xsl:variable name="toc.params">
122 <xsl:call-template name="find.path.params">
123 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
127 <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 1">
128 <xsl:call-template name="section.toc">
129 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
131 <xsl:call-template name="section.toc.separator"/>
133 <xsl:apply-templates/>
134 <xsl:call-template name="process.chunk.footnotes"/>
138 <xsl:template match="sect1/title |sect1/info/title |sect1info/title" mode="titlepage.mode" priority="2">
139 <xsl:call-template name="section.title"/>
142 <xsl:template match="sect2">
143 <xsl:call-template name="id.warning"/>
145 <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml">
146 <xsl:call-template name="common.html.attributes">
147 <xsl:with-param name="inherit" select="1"/>
149 <xsl:call-template name="id.attribute">
150 <xsl:with-param name="conditional" select="0"/>
154 <xsl:when test="@renderas = 'sect1'">
155 <xsl:call-template name="sect1.titlepage"/>
157 <xsl:when test="@renderas = 'sect3'">
158 <xsl:call-template name="sect3.titlepage"/>
160 <xsl:when test="@renderas = 'sect4'">
161 <xsl:call-template name="sect4.titlepage"/>
163 <xsl:when test="@renderas = 'sect5'">
164 <xsl:call-template name="sect5.titlepage"/>
167 <xsl:call-template name="sect2.titlepage"/>
171 <xsl:variable name="toc.params">
172 <xsl:call-template name="find.path.params">
173 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
177 <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 2">
178 <xsl:call-template name="section.toc">
179 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
181 <xsl:call-template name="section.toc.separator"/>
183 <xsl:apply-templates/>
184 <xsl:call-template name="process.chunk.footnotes"/>
188 <xsl:template match="sect2/title |sect2/info/title |sect2info/title" mode="titlepage.mode" priority="2">
189 <xsl:call-template name="section.title"/>
192 <xsl:template match="sect3">
193 <xsl:call-template name="id.warning"/>
195 <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml">
196 <xsl:call-template name="common.html.attributes">
197 <xsl:with-param name="inherit" select="1"/>
199 <xsl:call-template name="id.attribute">
200 <xsl:with-param name="conditional" select="0"/>
204 <xsl:when test="@renderas = 'sect1'">
205 <xsl:call-template name="sect1.titlepage"/>
207 <xsl:when test="@renderas = 'sect2'">
208 <xsl:call-template name="sect2.titlepage"/>
210 <xsl:when test="@renderas = 'sect4'">
211 <xsl:call-template name="sect4.titlepage"/>
213 <xsl:when test="@renderas = 'sect5'">
214 <xsl:call-template name="sect5.titlepage"/>
217 <xsl:call-template name="sect3.titlepage"/>
221 <xsl:variable name="toc.params">
222 <xsl:call-template name="find.path.params">
223 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
227 <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 3">
228 <xsl:call-template name="section.toc">
229 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
231 <xsl:call-template name="section.toc.separator"/>
233 <xsl:apply-templates/>
234 <xsl:call-template name="process.chunk.footnotes"/>
238 <xsl:template match="sect3/title |sect3/info/title |sect3info/title" mode="titlepage.mode" priority="2">
239 <xsl:call-template name="section.title"/>
242 <xsl:template match="sect4">
243 <xsl:call-template name="id.warning"/>
245 <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml">
246 <xsl:call-template name="common.html.attributes">
247 <xsl:with-param name="inherit" select="1"/>
249 <xsl:call-template name="id.attribute">
250 <xsl:with-param name="conditional" select="0"/>
254 <xsl:when test="@renderas = 'sect1'">
255 <xsl:call-template name="sect1.titlepage"/>
257 <xsl:when test="@renderas = 'sect2'">
258 <xsl:call-template name="sect2.titlepage"/>
260 <xsl:when test="@renderas = 'sect3'">
261 <xsl:call-template name="sect3.titlepage"/>
263 <xsl:when test="@renderas = 'sect5'">
264 <xsl:call-template name="sect5.titlepage"/>
267 <xsl:call-template name="sect4.titlepage"/>
271 <xsl:variable name="toc.params">
272 <xsl:call-template name="find.path.params">
273 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
277 <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 4">
278 <xsl:call-template name="section.toc">
279 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
281 <xsl:call-template name="section.toc.separator"/>
283 <xsl:apply-templates/>
284 <xsl:call-template name="process.chunk.footnotes"/>
288 <xsl:template match="sect4/title |sect4/info/title |sect4info/title" mode="titlepage.mode" priority="2">
289 <xsl:call-template name="section.title"/>
292 <xsl:template match="sect5">
293 <xsl:call-template name="id.warning"/>
295 <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml">
296 <xsl:call-template name="common.html.attributes">
297 <xsl:with-param name="inherit" select="1"/>
299 <xsl:call-template name="id.attribute">
300 <xsl:with-param name="conditional" select="0"/>
304 <xsl:when test="@renderas = 'sect1'">
305 <xsl:call-template name="sect1.titlepage"/>
307 <xsl:when test="@renderas = 'sect2'">
308 <xsl:call-template name="sect2.titlepage"/>
310 <xsl:when test="@renderas = 'sect3'">
311 <xsl:call-template name="sect3.titlepage"/>
313 <xsl:when test="@renderas = 'sect4'">
314 <xsl:call-template name="sect4.titlepage"/>
317 <xsl:call-template name="sect5.titlepage"/>
321 <xsl:variable name="toc.params">
322 <xsl:call-template name="find.path.params">
323 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
327 <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 5">
328 <xsl:call-template name="section.toc">
329 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
331 <xsl:call-template name="section.toc.separator"/>
333 <xsl:apply-templates/>
334 <xsl:call-template name="process.chunk.footnotes"/>
338 <xsl:template match="sect5/title |sect5/info/title |sect5info/title" mode="titlepage.mode" priority="2">
339 <xsl:call-template name="section.title"/>
342 <xsl:template match="simplesect">
343 <xsl:call-template name="id.warning"/>
345 <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml">
346 <xsl:call-template name="common.html.attributes">
347 <xsl:with-param name="inherit" select="1"/>
349 <xsl:call-template name="id.attribute">
350 <xsl:with-param name="conditional" select="0"/>
353 <xsl:call-template name="simplesect.titlepage"/>
354 <xsl:apply-templates/>
358 <xsl:template match="simplesect/title|simplesect/info/title" mode="titlepage.mode" priority="2">
359 <xsl:call-template name="section.title"/>
362 <xsl:template match="section/title"/>
363 <xsl:template match="section/titleabbrev"/>
364 <xsl:template match="section/subtitle"/>
365 <xsl:template match="sectioninfo"/>
366 <xsl:template match="section/info"/>
368 <xsl:template match="sect1/title"/>
369 <xsl:template match="sect1/titleabbrev"/>
370 <xsl:template match="sect1/subtitle"/>
371 <xsl:template match="sect1info"/>
372 <xsl:template match="sect1/info"/>
374 <xsl:template match="sect2/title"/>
375 <xsl:template match="sect2/subtitle"/>
376 <xsl:template match="sect2/titleabbrev"/>
377 <xsl:template match="sect2info"/>
378 <xsl:template match="sect2/info"/>
380 <xsl:template match="sect3/title"/>
381 <xsl:template match="sect3/subtitle"/>
382 <xsl:template match="sect3/titleabbrev"/>
383 <xsl:template match="sect3info"/>
384 <xsl:template match="sect3/info"/>
386 <xsl:template match="sect4/title"/>
387 <xsl:template match="sect4/subtitle"/>
388 <xsl:template match="sect4/titleabbrev"/>
389 <xsl:template match="sect4info"/>
390 <xsl:template match="sect4/info"/>
392 <xsl:template match="sect5/title"/>
393 <xsl:template match="sect5/subtitle"/>
394 <xsl:template match="sect5/titleabbrev"/>
395 <xsl:template match="sect5info"/>
396 <xsl:template match="sect5/info"/>
398 <xsl:template match="simplesect/title"/>
399 <xsl:template match="simplesect/subtitle"/>
400 <xsl:template match="simplesect/titleabbrev"/>
401 <xsl:template match="simplesect/info"/>
403 <!-- ==================================================================== -->
405 <xsl:template name="section.heading">
406 <xsl:param name="section" select="."/>
407 <xsl:param name="level" select="1"/>
408 <xsl:param name="allow-anchors" select="1"/>
409 <xsl:param name="title"/>
410 <xsl:param name="class" select="'title'"/>
412 <xsl:variable name="id">
414 <!-- Make sure the subtitle doesn't get the same id as the title -->
415 <xsl:when test="self::subtitle">
416 <xsl:call-template name="object.id">
417 <xsl:with-param name="object" select="."/>
420 <!-- if title is in an *info wrapper, get the grandparent -->
421 <xsl:when test="contains(local-name(..), 'info')">
422 <xsl:call-template name="object.id">
423 <xsl:with-param name="object" select="../.."/>
427 <xsl:call-template name="object.id">
428 <xsl:with-param name="object" select=".."/>
434 <!-- HTML H level is one higher than section level -->
435 <xsl:variable name="hlevel">
437 <!-- highest valid HTML H level is H6; so anything nested deeper
438 than 5 levels down just becomes H6 -->
439 <xsl:when test="$level > 5">6</xsl:when>
441 <xsl:value-of select="$level + 1"/>
445 <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml">
446 <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
447 <xsl:if test="$css.decoration != '0'">
448 <xsl:if test="$hlevel<3">
449 <xsl:attribute name="style">clear: both</xsl:attribute>
452 <xsl:if test="$allow-anchors != 0">
453 <xsl:call-template name="anchor">
454 <xsl:with-param name="node" select="$section"/>
455 <xsl:with-param name="conditional" select="0"/>
458 <xsl:copy-of select="$title"/>
462 <!-- ==================================================================== -->
464 <xsl:template match="bridgehead">
465 <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()]"/>
467 <xsl:variable name="clevel">
469 <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>
470 <xsl:when test="local-name($container) = 'glossdiv'">
471 <xsl:value-of select="count(ancestor::glossdiv)+1"/>
473 <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'">
474 <xsl:variable name="slevel">
475 <xsl:call-template name="section.level">
476 <xsl:with-param name="node" select="$container"/>
479 <xsl:value-of select="$slevel + 1"/>
481 <xsl:otherwise>1</xsl:otherwise>
485 <!-- HTML H level is one higher than section level -->
486 <xsl:variable name="hlevel">
488 <xsl:when test="@renderas = 'sect1'">2</xsl:when>
489 <xsl:when test="@renderas = 'sect2'">3</xsl:when>
490 <xsl:when test="@renderas = 'sect3'">4</xsl:when>
491 <xsl:when test="@renderas = 'sect4'">5</xsl:when>
492 <xsl:when test="@renderas = 'sect5'">6</xsl:when>
494 <xsl:value-of select="$clevel + 1"/>
499 <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml">
500 <xsl:call-template name="id.attribute">
501 <xsl:with-param name="conditional" select="0"/>
503 <xsl:call-template name="anchor">
504 <xsl:with-param name="conditional" select="0"/>
506 <xsl:apply-templates/>
510 <xsl:template match="section/subtitle" mode="titlepage.mode" priority="2">
511 <xsl:call-template name="section.subtitle"/>
514 <xsl:template match="simplesect/subtitle" mode="titlepage.mode" priority="2">
515 <xsl:call-template name="section.subtitle"/>
518 <xsl:template match="sect1/subtitle" mode="titlepage.mode" priority="2">
519 <xsl:call-template name="section.subtitle"/>
522 <xsl:template match="sect2/subtitle" mode="titlepage.mode" priority="2">
523 <xsl:call-template name="section.subtitle"/>
526 <xsl:template match="sect3/subtitle" mode="titlepage.mode" priority="2">
527 <xsl:call-template name="section.subtitle"/>
530 <xsl:template match="sect4/subtitle" mode="titlepage.mode" priority="2">
531 <xsl:call-template name="section.subtitle"/>
534 <xsl:template match="sect5/subtitle" mode="titlepage.mode" priority="2">
535 <xsl:call-template name="section.subtitle"/>
538 <xsl:template name="section.subtitle">
539 <!-- the context node should be the subtitle of a section when called -->
540 <xsl:variable name="section" select="(ancestor::section |ancestor::simplesect |ancestor::sect1 |ancestor::sect2 |ancestor::sect3 |ancestor::sect4 |ancestor::sect5)[last()]"/>
542 <xsl:variable name="level">
543 <xsl:call-template name="section.level">
544 <xsl:with-param name="node" select="$section"/>
548 <xsl:call-template name="section.heading">
549 <xsl:with-param name="section" select=".."/>
550 <xsl:with-param name="allow-anchors" select="0"/>
551 <!-- subtitle heading level one higher than section level -->
552 <xsl:with-param name="level" select="$level + 1"/>
553 <xsl:with-param name="class" select="'subtitle'"/>
554 <xsl:with-param name="title">
555 <xsl:apply-templates select="$section" mode="object.subtitle.markup">
556 <xsl:with-param name="allow-anchors" select="0"/>
557 </xsl:apply-templates>