source: clfs-sysroot/BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/xhtml/sections.xsl@ 8a63c91

Last change on this file since 8a63c91 was a18aefd, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added lfs-xsl stylesheets.

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