2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5 <!-- ********************************************************************
6 $Id: component.xsl 8568 2010-01-11 03:16:56Z bobstayton $
7 ********************************************************************
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.
13 ******************************************************************** -->
15 <!-- ==================================================================== -->
17 <xsl:template name="component.title">
18 <xsl:param name="node" select="."/>
20 <xsl:variable name="level">
22 <xsl:when test="ancestor::section">
23 <xsl:value-of select="count(ancestor::section)+1"/>
25 <xsl:when test="ancestor::sect5">6</xsl:when>
26 <xsl:when test="ancestor::sect4">5</xsl:when>
27 <xsl:when test="ancestor::sect3">4</xsl:when>
28 <xsl:when test="ancestor::sect2">3</xsl:when>
29 <xsl:when test="ancestor::sect1">2</xsl:when>
30 <xsl:otherwise>1</xsl:otherwise>
34 <!-- Let's handle the case where a component (bibliography, for example)
35 occurs inside a section; will we need parameters for this? -->
37 <xsl:element name="h{$level+1}">
38 <xsl:attribute name="class">title</xsl:attribute>
39 <xsl:if test="$generate.id.attributes = 0">
40 <xsl:call-template name="anchor">
41 <xsl:with-param name="node" select="$node"/>
42 <xsl:with-param name="conditional" select="0"/>
45 <xsl:apply-templates select="$node" mode="object.title.markup">
46 <xsl:with-param name="allow-anchors" select="1"/>
47 </xsl:apply-templates>
51 <xsl:template name="component.subtitle">
52 <xsl:param name="node" select="."/>
53 <xsl:variable name="subtitle"
54 select="($node/docinfo/subtitle
56 |$node/prefaceinfo/subtitle
57 |$node/chapterinfo/subtitle
58 |$node/appendixinfo/subtitle
59 |$node/articleinfo/subtitle
60 |$node/artheader/subtitle
61 |$node/subtitle)[1]"/>
63 <xsl:if test="$subtitle">
66 <xsl:apply-templates select="$node" mode="object.subtitle.markup"/>
72 <xsl:template name="component.separator">
75 <!-- ==================================================================== -->
77 <xsl:template match="dedication" mode="dedication">
78 <xsl:call-template name="id.warning"/>
81 <xsl:call-template name="common.html.attributes">
82 <xsl:with-param name="inherit" select="1"/>
84 <xsl:call-template name="dedication.titlepage"/>
85 <xsl:apply-templates/>
86 <xsl:call-template name="process.footnotes"/>
90 <xsl:template match="dedication/title|dedication/info/title"
91 mode="titlepage.mode" priority="2">
92 <xsl:call-template name="component.title">
93 <xsl:with-param name="node" select="ancestor::dedication[1]"/>
97 <xsl:template match="dedication/subtitle|dedication/info/subtitle"
98 mode="titlepage.mode" priority="2">
99 <xsl:call-template name="component.subtitle">
100 <xsl:with-param name="node" select="ancestor::dedication[1]"/>
104 <xsl:template match="dedication"></xsl:template> <!-- see mode="dedication" -->
105 <xsl:template match="dedication/title"></xsl:template>
106 <xsl:template match="dedication/subtitle"></xsl:template>
107 <xsl:template match="dedication/titleabbrev"></xsl:template>
109 <!-- ==================================================================== -->
111 <xsl:template match="acknowledgements" mode="acknowledgements">
112 <xsl:call-template name="id.warning"/>
115 <xsl:call-template name="common.html.attributes">
116 <xsl:with-param name="inherit" select="1"/>
118 <xsl:call-template name="acknowledgements.titlepage"/>
119 <xsl:apply-templates/>
120 <xsl:call-template name="process.footnotes"/>
124 <xsl:template match="acknowledgements/title|acknowledgements/info/title"
125 mode="titlepage.mode" priority="2">
126 <xsl:call-template name="component.title">
127 <xsl:with-param name="node" select="ancestor::acknowledgements[1]"/>
131 <xsl:template match="acknowledgements/subtitle|acknowledgements/info/subtitle"
132 mode="titlepage.mode" priority="2">
133 <xsl:call-template name="component.subtitle">
134 <xsl:with-param name="node" select="ancestor::acknowledgements[1]"/>
138 <xsl:template match="acknowledgements"></xsl:template> <!-- see mode="acknowledgements" -->
139 <xsl:template match="acknowledgements/title"></xsl:template>
140 <xsl:template match="acknowledgements/subtitle"></xsl:template>
141 <xsl:template match="acknowledgements/titleabbrev"></xsl:template>
143 <!-- ==================================================================== -->
145 <xsl:template match="colophon">
146 <xsl:call-template name="id.warning"/>
149 <xsl:call-template name="common.html.attributes">
150 <xsl:with-param name="inherit" select="1"/>
152 <xsl:if test="$generate.id.attributes != 0">
153 <xsl:attribute name="id">
154 <xsl:call-template name="object.id"/>
158 <xsl:call-template name="component.separator"/>
159 <xsl:call-template name="component.title"/>
160 <xsl:call-template name="component.subtitle"/>
162 <xsl:apply-templates/>
163 <xsl:call-template name="process.footnotes"/>
167 <xsl:template match="colophon/title"></xsl:template>
168 <xsl:template match="colophon/subtitle"></xsl:template>
169 <xsl:template match="colophon/titleabbrev"></xsl:template>
171 <!-- ==================================================================== -->
173 <xsl:template match="preface">
174 <xsl:call-template name="id.warning"/>
177 <xsl:call-template name="common.html.attributes">
178 <xsl:with-param name="inherit" select="1"/>
180 <xsl:if test="$generate.id.attributes != 0">
181 <xsl:attribute name="id">
182 <xsl:call-template name="object.id"/>
186 <xsl:call-template name="component.separator"/>
187 <xsl:call-template name="preface.titlepage"/>
189 <xsl:variable name="toc.params">
190 <xsl:call-template name="find.path.params">
191 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
195 <xsl:if test="contains($toc.params, 'toc')">
196 <xsl:call-template name="component.toc">
197 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
199 <xsl:call-template name="component.toc.separator"/>
201 <xsl:apply-templates/>
202 <xsl:call-template name="process.footnotes"/>
206 <xsl:template match="preface/title" mode="titlepage.mode" priority="2">
207 <xsl:call-template name="component.title">
208 <xsl:with-param name="node" select="ancestor::preface[1]"/>
212 <xsl:template match="preface/subtitle
213 |preface/prefaceinfo/subtitle
214 |preface/info/subtitle
215 |preface/docinfo/subtitle"
216 mode="titlepage.mode" priority="2">
217 <xsl:call-template name="component.subtitle">
218 <xsl:with-param name="node" select="ancestor::preface[1]"/>
222 <xsl:template match="preface/docinfo|prefaceinfo"></xsl:template>
223 <xsl:template match="preface/info"></xsl:template>
224 <xsl:template match="preface/title"></xsl:template>
225 <xsl:template match="preface/titleabbrev"></xsl:template>
226 <xsl:template match="preface/subtitle"></xsl:template>
228 <!-- ==================================================================== -->
230 <xsl:template match="chapter">
231 <xsl:call-template name="id.warning"/>
234 <xsl:call-template name="common.html.attributes">
235 <xsl:with-param name="inherit" select="1"/>
237 <xsl:if test="$generate.id.attributes != 0">
238 <xsl:attribute name="id">
239 <xsl:call-template name="object.id"/>
243 <xsl:call-template name="component.separator"/>
244 <xsl:call-template name="chapter.titlepage"/>
246 <xsl:variable name="toc.params">
247 <xsl:call-template name="find.path.params">
248 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
251 <xsl:if test="contains($toc.params, 'toc')">
252 <xsl:call-template name="component.toc">
253 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
255 <xsl:call-template name="component.toc.separator"/>
257 <xsl:apply-templates/>
258 <xsl:call-template name="process.footnotes"/>
262 <xsl:template match="chapter/title|chapter/chapterinfo/title|chapter/info/title"
263 mode="titlepage.mode" priority="2">
264 <xsl:call-template name="component.title">
265 <xsl:with-param name="node" select="ancestor::chapter[1]"/>
269 <xsl:template match="chapter/subtitle
270 |chapter/chapterinfo/subtitle
271 |chapter/info/subtitle
272 |chapter/docinfo/subtitle"
273 mode="titlepage.mode" priority="2">
274 <xsl:call-template name="component.subtitle">
275 <xsl:with-param name="node" select="ancestor::chapter[1]"/>
279 <xsl:template match="chapter/docinfo|chapterinfo"></xsl:template>
280 <xsl:template match="chapter/info"></xsl:template>
281 <xsl:template match="chapter/title"></xsl:template>
282 <xsl:template match="chapter/titleabbrev"></xsl:template>
283 <xsl:template match="chapter/subtitle"></xsl:template>
285 <!-- ==================================================================== -->
287 <xsl:template match="appendix">
288 <xsl:variable name="ischunk">
289 <xsl:call-template name="chunk"/>
292 <xsl:call-template name="id.warning"/>
295 <xsl:call-template name="common.html.attributes">
296 <xsl:with-param name="inherit" select="1"/>
298 <xsl:if test="$generate.id.attributes != 0">
299 <xsl:attribute name="id">
300 <xsl:call-template name="object.id"/>
305 <xsl:when test="parent::article and $ischunk = 0">
306 <xsl:call-template name="section.heading">
307 <xsl:with-param name="level" select="1"/>
308 <xsl:with-param name="title">
309 <xsl:apply-templates select="." mode="object.title.markup"/>
314 <xsl:call-template name="component.separator"/>
315 <xsl:call-template name="appendix.titlepage"/>
319 <xsl:variable name="toc.params">
320 <xsl:call-template name="find.path.params">
321 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
325 <xsl:if test="contains($toc.params, 'toc')">
326 <xsl:call-template name="component.toc">
327 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
329 <xsl:call-template name="component.toc.separator"/>
332 <xsl:apply-templates/>
334 <xsl:if test="not(parent::article) or $ischunk != 0">
335 <xsl:call-template name="process.footnotes"/>
340 <xsl:template match="appendix/title|appendix/appendixinfo/title"
341 mode="titlepage.mode" priority="2">
342 <xsl:call-template name="component.title">
343 <xsl:with-param name="node" select="ancestor::appendix[1]"/>
347 <xsl:template match="appendix/subtitle
348 |appendix/appendixinfo/subtitle
349 |appendix/info/subtitle
350 |appendix/docinfo/subtitle"
351 mode="titlepage.mode" priority="2">
352 <xsl:call-template name="component.subtitle">
353 <xsl:with-param name="node" select="ancestor::appendix[1]"/>
357 <xsl:template match="appendix/docinfo|appendixinfo"></xsl:template>
358 <xsl:template match="appendix/info"></xsl:template>
359 <xsl:template match="appendix/title"></xsl:template>
360 <xsl:template match="appendix/titleabbrev"></xsl:template>
361 <xsl:template match="appendix/subtitle"></xsl:template>
363 <!-- ==================================================================== -->
365 <xsl:template match="article">
366 <xsl:call-template name="id.warning"/>
369 <xsl:call-template name="common.html.attributes">
370 <xsl:with-param name="inherit" select="1"/>
372 <xsl:if test="$generate.id.attributes != 0">
373 <xsl:attribute name="id">
374 <xsl:call-template name="object.id"/>
378 <xsl:call-template name="article.titlepage"/>
380 <xsl:variable name="toc.params">
381 <xsl:call-template name="find.path.params">
382 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
386 <xsl:call-template name="make.lots">
387 <xsl:with-param name="toc.params" select="$toc.params"/>
388 <xsl:with-param name="toc">
389 <xsl:call-template name="component.toc">
390 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
395 <xsl:apply-templates/>
396 <xsl:call-template name="process.footnotes"/>
400 <xsl:template match="article/title|article/articleinfo/title" mode="titlepage.mode" priority="2">
401 <xsl:call-template name="component.title">
402 <xsl:with-param name="node" select="ancestor::article[1]"/>
406 <xsl:template match="article/subtitle
407 |article/articleinfo/subtitle
408 |article/info/subtitle
409 |article/artheader/subtitle"
410 mode="titlepage.mode" priority="2">
411 <xsl:call-template name="component.subtitle">
412 <xsl:with-param name="node" select="ancestor::article[1]"/>
416 <xsl:template match="article/artheader|article/articleinfo"></xsl:template>
417 <xsl:template match="article/info"></xsl:template>
418 <xsl:template match="article/title"></xsl:template>
419 <xsl:template match="article/titleabbrev"></xsl:template>
420 <xsl:template match="article/subtitle"></xsl:template>
422 <!-- ==================================================================== -->