source: clfs-embedded/BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/xhtml/component.xsl@ c2f4c89

Last change on this file since c2f4c89 was 9882b55, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added the new lfs-xsl stylesheets.

  • Property mode set to 100644
File size: 13.5 KB
RevLine 
[9882b55]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 name="component.title">
19 <xsl:param name="node" select="."/>
20
21 <xsl:variable name="level">
22 <xsl:choose>
23 <xsl:when test="ancestor::section">
24 <xsl:value-of select="count(ancestor::section)+1"/>
25 </xsl:when>
26 <xsl:when test="ancestor::sect5">6</xsl:when>
27 <xsl:when test="ancestor::sect4">5</xsl:when>
28 <xsl:when test="ancestor::sect3">4</xsl:when>
29 <xsl:when test="ancestor::sect2">3</xsl:when>
30 <xsl:when test="ancestor::sect1">2</xsl:when>
31 <xsl:otherwise>1</xsl:otherwise>
32 </xsl:choose>
33 </xsl:variable>
34
35 <!-- Let's handle the case where a component (bibliography, for example)
36 occurs inside a section; will we need parameters for this? -->
37
38 <xsl:element name="h{$level+1}" namespace="http://www.w3.org/1999/xhtml">
39 <xsl:attribute name="class">title</xsl:attribute>
40 <xsl:call-template name="anchor">
41 <xsl:with-param name="node" select="$node"/>
42 <xsl:with-param name="conditional" select="0"/>
43 </xsl:call-template>
44 <xsl:apply-templates select="$node" mode="object.title.markup">
45 <xsl:with-param name="allow-anchors" select="1"/>
46 </xsl:apply-templates>
47 </xsl:element>
48</xsl:template>
49
50<xsl:template name="component.subtitle">
51 <xsl:param name="node" select="."/>
52 <xsl:variable name="subtitle" select="($node/docinfo/subtitle |$node/info/subtitle |$node/prefaceinfo/subtitle |$node/chapterinfo/subtitle |$node/appendixinfo/subtitle |$node/articleinfo/subtitle |$node/artheader/subtitle |$node/subtitle)[1]"/>
53
54 <xsl:if test="$subtitle">
55 <h3 class="subtitle">
56 <i>
57 <xsl:apply-templates select="$node" mode="object.subtitle.markup"/>
58 </i>
59 </h3>
60 </xsl:if>
61</xsl:template>
62
63<xsl:template name="component.separator">
64</xsl:template>
65
66<!-- ==================================================================== -->
67
68<xsl:template match="dedication" mode="dedication">
69 <xsl:call-template name="id.warning"/>
70
71 <div>
72 <xsl:apply-templates select="." mode="class.attribute"/>
73 <xsl:call-template name="dir">
74 <xsl:with-param name="inherit" select="1"/>
75 </xsl:call-template>
76 <xsl:call-template name="language.attribute"/>
77 <xsl:call-template name="dedication.titlepage"/>
78 <xsl:apply-templates/>
79 <xsl:call-template name="process.footnotes"/>
80 </div>
81</xsl:template>
82
83<xsl:template match="dedication/title|dedication/info/title" mode="titlepage.mode" priority="2">
84 <xsl:call-template name="component.title">
85 <xsl:with-param name="node" select="ancestor::dedication[1]"/>
86 </xsl:call-template>
87</xsl:template>
88
89<xsl:template match="dedication/subtitle|dedication/info/subtitle" mode="titlepage.mode" priority="2">
90 <xsl:call-template name="component.subtitle">
91 <xsl:with-param name="node" select="ancestor::dedication[1]"/>
92 </xsl:call-template>
93</xsl:template>
94
95<xsl:template match="dedication"/> <!-- see mode="dedication" -->
96<xsl:template match="dedication/title"/>
97<xsl:template match="dedication/subtitle"/>
98<xsl:template match="dedication/titleabbrev"/>
99
100<!-- ==================================================================== -->
101
102<xsl:template match="colophon">
103 <xsl:call-template name="id.warning"/>
104
105 <div>
106 <xsl:apply-templates select="." mode="class.attribute"/>
107 <xsl:call-template name="dir">
108 <xsl:with-param name="inherit" select="1"/>
109 </xsl:call-template>
110 <xsl:call-template name="language.attribute"/>
111 <xsl:if test="$generate.id.attributes != 0">
112 <xsl:attribute name="id">
113 <xsl:call-template name="object.id"/>
114 </xsl:attribute>
115 </xsl:if>
116
117 <xsl:call-template name="component.separator"/>
118 <xsl:call-template name="component.title"/>
119 <xsl:call-template name="component.subtitle"/>
120
121 <xsl:apply-templates/>
122 <xsl:call-template name="process.footnotes"/>
123 </div>
124</xsl:template>
125
126<xsl:template match="colophon/title"/>
127<xsl:template match="colophon/subtitle"/>
128<xsl:template match="colophon/titleabbrev"/>
129
130<!-- ==================================================================== -->
131
132<xsl:template match="preface">
133 <xsl:call-template name="id.warning"/>
134
135 <div>
136 <xsl:apply-templates select="." mode="class.attribute"/>
137 <xsl:call-template name="dir">
138 <xsl:with-param name="inherit" select="1"/>
139 </xsl:call-template>
140 <xsl:call-template name="language.attribute"/>
141 <xsl:if test="$generate.id.attributes != 0">
142 <xsl:attribute name="id">
143 <xsl:call-template name="object.id"/>
144 </xsl:attribute>
145 </xsl:if>
146
147 <xsl:call-template name="component.separator"/>
148 <xsl:call-template name="preface.titlepage"/>
149
150 <xsl:variable name="toc.params">
151 <xsl:call-template name="find.path.params">
152 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
153 </xsl:call-template>
154 </xsl:variable>
155
156 <xsl:if test="contains($toc.params, 'toc')">
157 <xsl:call-template name="component.toc">
158 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
159 </xsl:call-template>
160 <xsl:call-template name="component.toc.separator"/>
161 </xsl:if>
162 <xsl:apply-templates/>
163 <xsl:call-template name="process.footnotes"/>
164 </div>
165</xsl:template>
166
167<xsl:template match="preface/title" mode="titlepage.mode" priority="2">
168 <xsl:call-template name="component.title">
169 <xsl:with-param name="node" select="ancestor::preface[1]"/>
170 </xsl:call-template>
171</xsl:template>
172
173<xsl:template match="preface/subtitle |preface/prefaceinfo/subtitle |preface/info/subtitle |preface/docinfo/subtitle" mode="titlepage.mode" priority="2">
174 <xsl:call-template name="component.subtitle">
175 <xsl:with-param name="node" select="ancestor::preface[1]"/>
176 </xsl:call-template>
177</xsl:template>
178
179<xsl:template match="preface/docinfo|prefaceinfo"/>
180<xsl:template match="preface/info"/>
181<xsl:template match="preface/title"/>
182<xsl:template match="preface/titleabbrev"/>
183<xsl:template match="preface/subtitle"/>
184
185<!-- ==================================================================== -->
186
187<xsl:template match="chapter">
188 <xsl:call-template name="id.warning"/>
189
190 <div>
191 <xsl:apply-templates select="." mode="class.attribute"/>
192 <xsl:call-template name="dir">
193 <xsl:with-param name="inherit" select="1"/>
194 </xsl:call-template>
195 <xsl:call-template name="language.attribute"/>
196 <xsl:if test="$generate.id.attributes != 0">
197 <xsl:attribute name="id">
198 <xsl:call-template name="object.id"/>
199 </xsl:attribute>
200 </xsl:if>
201
202 <xsl:call-template name="component.separator"/>
203 <xsl:call-template name="chapter.titlepage"/>
204
205 <xsl:variable name="toc.params">
206 <xsl:call-template name="find.path.params">
207 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
208 </xsl:call-template>
209 </xsl:variable>
210 <xsl:if test="contains($toc.params, 'toc')">
211 <xsl:call-template name="component.toc">
212 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
213 </xsl:call-template>
214 <xsl:call-template name="component.toc.separator"/>
215 </xsl:if>
216 <xsl:apply-templates/>
217 <xsl:call-template name="process.footnotes"/>
218 </div>
219</xsl:template>
220
221<xsl:template match="chapter/title" mode="titlepage.mode" priority="2">
222 <xsl:call-template name="component.title">
223 <xsl:with-param name="node" select="ancestor::chapter[1]"/>
224 </xsl:call-template>
225</xsl:template>
226
227<xsl:template match="chapter/subtitle |chapter/chapterinfo/subtitle |chapter/info/subtitle |chapter/docinfo/subtitle" mode="titlepage.mode" priority="2">
228 <xsl:call-template name="component.subtitle">
229 <xsl:with-param name="node" select="ancestor::chapter[1]"/>
230 </xsl:call-template>
231</xsl:template>
232
233<xsl:template match="chapter/docinfo|chapterinfo"/>
234<xsl:template match="chapter/info"/>
235<xsl:template match="chapter/title"/>
236<xsl:template match="chapter/titleabbrev"/>
237<xsl:template match="chapter/subtitle"/>
238
239<!-- ==================================================================== -->
240
241<xsl:template match="appendix">
242 <xsl:variable name="ischunk">
243 <xsl:call-template name="chunk"/>
244 </xsl:variable>
245
246 <xsl:call-template name="id.warning"/>
247
248 <div>
249 <xsl:apply-templates select="." mode="class.attribute"/>
250 <xsl:call-template name="dir">
251 <xsl:with-param name="inherit" select="1"/>
252 </xsl:call-template>
253 <xsl:call-template name="language.attribute"/>
254 <xsl:if test="$generate.id.attributes != 0">
255 <xsl:attribute name="id">
256 <xsl:call-template name="object.id"/>
257 </xsl:attribute>
258 </xsl:if>
259
260 <xsl:choose>
261 <xsl:when test="parent::article and $ischunk = 0">
262 <xsl:call-template name="section.heading">
263 <xsl:with-param name="level" select="1"/>
264 <xsl:with-param name="title">
265 <xsl:apply-templates select="." mode="object.title.markup"/>
266 </xsl:with-param>
267 </xsl:call-template>
268 </xsl:when>
269 <xsl:otherwise>
270 <xsl:call-template name="component.separator"/>
271 <xsl:call-template name="appendix.titlepage"/>
272 </xsl:otherwise>
273 </xsl:choose>
274
275 <xsl:variable name="toc.params">
276 <xsl:call-template name="find.path.params">
277 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
278 </xsl:call-template>
279 </xsl:variable>
280
281 <xsl:if test="contains($toc.params, 'toc')">
282 <xsl:call-template name="component.toc">
283 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
284 </xsl:call-template>
285 <xsl:call-template name="component.toc.separator"/>
286 </xsl:if>
287
288 <xsl:apply-templates/>
289
290 <xsl:if test="not(parent::article) or $ischunk != 0">
291 <xsl:call-template name="process.footnotes"/>
292 </xsl:if>
293 </div>
294</xsl:template>
295
296<xsl:template match="appendix/title" mode="titlepage.mode" priority="2">
297 <xsl:call-template name="component.title">
298 <xsl:with-param name="node" select="ancestor::appendix[1]"/>
299 </xsl:call-template>
300</xsl:template>
301
302<xsl:template match="appendix/subtitle |appendix/appendixinfo/subtitle |appendix/info/subtitle |appendix/docinfo/subtitle" mode="titlepage.mode" priority="2">
303 <xsl:call-template name="component.subtitle">
304 <xsl:with-param name="node" select="ancestor::appendix[1]"/>
305 </xsl:call-template>
306</xsl:template>
307
308<xsl:template match="appendix/docinfo|appendixinfo"/>
309<xsl:template match="appendix/info"/>
310<xsl:template match="appendix/title"/>
311<xsl:template match="appendix/titleabbrev"/>
312<xsl:template match="appendix/subtitle"/>
313
314<!-- ==================================================================== -->
315
316<xsl:template match="article">
317 <xsl:call-template name="id.warning"/>
318
319 <div>
320 <xsl:apply-templates select="." mode="class.attribute"/>
321 <xsl:call-template name="dir">
322 <xsl:with-param name="inherit" select="1"/>
323 </xsl:call-template>
324 <xsl:call-template name="language.attribute"/>
325 <xsl:if test="$generate.id.attributes != 0">
326 <xsl:attribute name="id">
327 <xsl:call-template name="object.id"/>
328 </xsl:attribute>
329 </xsl:if>
330
331 <xsl:call-template name="article.titlepage"/>
332
333 <xsl:variable name="toc.params">
334 <xsl:call-template name="find.path.params">
335 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
336 </xsl:call-template>
337 </xsl:variable>
338
339 <xsl:call-template name="make.lots">
340 <xsl:with-param name="toc.params" select="$toc.params"/>
341 <xsl:with-param name="toc">
342 <xsl:call-template name="component.toc">
343 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
344 </xsl:call-template>
345 </xsl:with-param>
346 </xsl:call-template>
347
348 <xsl:apply-templates/>
349 <xsl:call-template name="process.footnotes"/>
350 </div>
351</xsl:template>
352
353<xsl:template match="article/title" mode="titlepage.mode" priority="2">
354 <xsl:call-template name="component.title">
355 <xsl:with-param name="node" select="ancestor::article[1]"/>
356 </xsl:call-template>
357</xsl:template>
358
359<xsl:template match="article/subtitle |article/articleinfo/subtitle |article/info/subtitle |article/artheader/subtitle" mode="titlepage.mode" priority="2">
360 <xsl:call-template name="component.subtitle">
361 <xsl:with-param name="node" select="ancestor::article[1]"/>
362 </xsl:call-template>
363</xsl:template>
364
365<xsl:template match="article/artheader|article/articleinfo"/>
366<xsl:template match="article/info"/>
367<xsl:template match="article/title"/>
368<xsl:template match="article/titleabbrev"/>
369<xsl:template match="article/subtitle"/>
370
371<!-- ==================================================================== -->
372
373</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.