Debian Codegraph @

docbook-xsl-ns/xhtml/component.xsl

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