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">
3 <!-- ********************************************************************
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.
9 ******************************************************************** -->
11 <!-- ==================================================================== -->
13 <xsl:template match="d:section">
14 <xsl:variable name="depth" select="count(ancestor::d:section)+1"/>
16 <xsl:call-template name="id.warning"/>
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"/>
22 <xsl:call-template name="id.attribute">
23 <xsl:with-param name="conditional" select="0"/>
25 <xsl:call-template name="section.titlepage"/>
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)"/>
33 <xsl:if test="contains($toc.params, 'toc') and $depth <= $generate.section.toc.level">
34 <xsl:call-template name="section.toc">
35 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
37 <xsl:call-template name="section.toc.separator"/>
39 <xsl:apply-templates/>
40 <xsl:call-template name="process.chunk.footnotes"/>
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()]"/>
48 <xsl:variable name="renderas">
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>
59 <xsl:variable name="level">
61 <xsl:when test="$renderas != ''">
62 <xsl:value-of select="$renderas"/>
65 <xsl:call-template name="section.level">
66 <xsl:with-param name="node" select="$section"/>
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>
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"/>
87 <xsl:template match="d:sect1">
88 <xsl:call-template name="id.warning"/>
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"/>
94 <xsl:call-template name="id.attribute">
95 <xsl:with-param name="conditional" select="0"/>
99 <xsl:when test="@renderas = 'sect2'">
100 <xsl:call-template name="sect2.titlepage"/>
102 <xsl:when test="@renderas = 'sect3'">
103 <xsl:call-template name="sect3.titlepage"/>
105 <xsl:when test="@renderas = 'sect4'">
106 <xsl:call-template name="sect4.titlepage"/>
108 <xsl:when test="@renderas = 'sect5'">
109 <xsl:call-template name="sect5.titlepage"/>
112 <xsl:call-template name="sect1.titlepage"/>
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)"/>
122 <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 1">
123 <xsl:call-template name="section.toc">
124 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
126 <xsl:call-template name="section.toc.separator"/>
128 <xsl:apply-templates/>
129 <xsl:call-template name="process.chunk.footnotes"/>
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"/>
137 <xsl:template match="d:sect2">
138 <xsl:call-template name="id.warning"/>
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"/>
144 <xsl:call-template name="id.attribute">
145 <xsl:with-param name="conditional" select="0"/>
149 <xsl:when test="@renderas = 'sect1'">
150 <xsl:call-template name="sect1.titlepage"/>
152 <xsl:when test="@renderas = 'sect3'">
153 <xsl:call-template name="sect3.titlepage"/>
155 <xsl:when test="@renderas = 'sect4'">
156 <xsl:call-template name="sect4.titlepage"/>
158 <xsl:when test="@renderas = 'sect5'">
159 <xsl:call-template name="sect5.titlepage"/>
162 <xsl:call-template name="sect2.titlepage"/>
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)"/>
172 <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 2">
173 <xsl:call-template name="section.toc">
174 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
176 <xsl:call-template name="section.toc.separator"/>
178 <xsl:apply-templates/>
179 <xsl:call-template name="process.chunk.footnotes"/>
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"/>
187 <xsl:template match="d:sect3">
188 <xsl:call-template name="id.warning"/>
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"/>
194 <xsl:call-template name="id.attribute">
195 <xsl:with-param name="conditional" select="0"/>
199 <xsl:when test="@renderas = 'sect1'">
200 <xsl:call-template name="sect1.titlepage"/>
202 <xsl:when test="@renderas = 'sect2'">
203 <xsl:call-template name="sect2.titlepage"/>
205 <xsl:when test="@renderas = 'sect4'">
206 <xsl:call-template name="sect4.titlepage"/>
208 <xsl:when test="@renderas = 'sect5'">
209 <xsl:call-template name="sect5.titlepage"/>
212 <xsl:call-template name="sect3.titlepage"/>
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)"/>
222 <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 3">
223 <xsl:call-template name="section.toc">
224 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
226 <xsl:call-template name="section.toc.separator"/>
228 <xsl:apply-templates/>
229 <xsl:call-template name="process.chunk.footnotes"/>
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"/>
237 <xsl:template match="d:sect4">
238 <xsl:call-template name="id.warning"/>
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"/>
244 <xsl:call-template name="id.attribute">
245 <xsl:with-param name="conditional" select="0"/>
249 <xsl:when test="@renderas = 'sect1'">
250 <xsl:call-template name="sect1.titlepage"/>
252 <xsl:when test="@renderas = 'sect2'">
253 <xsl:call-template name="sect2.titlepage"/>
255 <xsl:when test="@renderas = 'sect3'">
256 <xsl:call-template name="sect3.titlepage"/>
258 <xsl:when test="@renderas = 'sect5'">
259 <xsl:call-template name="sect5.titlepage"/>
262 <xsl:call-template name="sect4.titlepage"/>
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)"/>
272 <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 4">
273 <xsl:call-template name="section.toc">
274 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
276 <xsl:call-template name="section.toc.separator"/>
278 <xsl:apply-templates/>
279 <xsl:call-template name="process.chunk.footnotes"/>
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"/>
287 <xsl:template match="d:sect5">
288 <xsl:call-template name="id.warning"/>
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"/>
294 <xsl:call-template name="id.attribute">
295 <xsl:with-param name="conditional" select="0"/>
299 <xsl:when test="@renderas = 'sect1'">
300 <xsl:call-template name="sect1.titlepage"/>
302 <xsl:when test="@renderas = 'sect2'">
303 <xsl:call-template name="sect2.titlepage"/>
305 <xsl:when test="@renderas = 'sect3'">
306 <xsl:call-template name="sect3.titlepage"/>
308 <xsl:when test="@renderas = 'sect4'">
309 <xsl:call-template name="sect4.titlepage"/>
312 <xsl:call-template name="sect5.titlepage"/>
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)"/>
322 <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 5">
323 <xsl:call-template name="section.toc">
324 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
326 <xsl:call-template name="section.toc.separator"/>
328 <xsl:apply-templates/>
329 <xsl:call-template name="process.chunk.footnotes"/>
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"/>
337 <xsl:template match="d:simplesect">
338 <xsl:call-template name="id.warning"/>
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"/>
344 <xsl:call-template name="id.attribute">
345 <xsl:with-param name="conditional" select="0"/>
348 <xsl:call-template name="simplesect.titlepage"/>
349 <xsl:apply-templates/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
398 <!-- ==================================================================== -->
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'"/>
407 <xsl:variable name="id">
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="."/>
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="../.."/>
422 <xsl:call-template name="object.id">
423 <xsl:with-param name="object" select=".."/>
429 <!-- HTML H level is one higher than section level -->
430 <xsl:variable name="hlevel">
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 > 5">6</xsl:when>
436 <xsl:value-of select="$level + 1"/>
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<3">
444 <xsl:attribute name="style">clear: both</xsl:attribute>
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"/>
453 <xsl:copy-of select="$title"/>
457 <!-- ==================================================================== -->
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()]"/>
462 <xsl:variable name="clevel">
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"/>
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"/>
474 <xsl:value-of select="$slevel + 1"/>
476 <xsl:otherwise>1</xsl:otherwise>
480 <!-- HTML H level is one higher than section level -->
481 <xsl:variable name="hlevel">
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>
489 <xsl:value-of select="$clevel + 1"/>
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"/>
498 <xsl:call-template name="anchor">
499 <xsl:with-param name="conditional" select="0"/>
501 <xsl:apply-templates/>
505 <xsl:template match="d:section/d:subtitle" mode="titlepage.mode" priority="2">
506 <xsl:call-template name="section.subtitle"/>
509 <xsl:template match="d:simplesect/d:subtitle" mode="titlepage.mode" priority="2">
510 <xsl:call-template name="section.subtitle"/>
513 <xsl:template match="d:sect1/d:subtitle" mode="titlepage.mode" priority="2">
514 <xsl:call-template name="section.subtitle"/>
517 <xsl:template match="d:sect2/d:subtitle" mode="titlepage.mode" priority="2">
518 <xsl:call-template name="section.subtitle"/>
521 <xsl:template match="d:sect3/d:subtitle" mode="titlepage.mode" priority="2">
522 <xsl:call-template name="section.subtitle"/>
525 <xsl:template match="d:sect4/d:subtitle" mode="titlepage.mode" priority="2">
526 <xsl:call-template name="section.subtitle"/>
529 <xsl:template match="d:sect5/d:subtitle" mode="titlepage.mode" priority="2">
530 <xsl:call-template name="section.subtitle"/>
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()]"/>
537 <xsl:variable name="level">
538 <xsl:call-template name="section.level">
539 <xsl:with-param name="node" select="$section"/>
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>