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