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$
7     ********************************************************************
8
9     This file is part of the XSL DocBook Stylesheet distribution.
10     See /README or http://nwalsh.com/docbook/xsl/ for copyright
11     and other information.
12
13     ******************************************************************** -->
14
15<!-- ==================================================================== -->
16
17<xsl:template name="component.title">
18  <xsl:param name="node" select="."/>
19  <xsl:variable name="id">
20    <xsl:call-template name="object.id">
21      <xsl:with-param name="object" select="$node"/>
22    </xsl:call-template>
23  </xsl:variable>
24
25  <h2 class="title">
26    <a name="{$id}"/>
27    <xsl:apply-templates select="$node" mode="object.title.markup"/>
28  </h2>
29</xsl:template>
30
31<xsl:template name="component.subtitle">
32  <xsl:param name="node" select="."/>
33  <xsl:variable name="subtitle"
34                select="($node/docinfo/subtitle
35                        |$node/prefaceinfo/subtitle
36                        |$node/chapterinfo/subtitle
37                        |$node/appendixinfo/subtitle
38                        |$node/subtitle)[1]"/>
39
40  <xsl:if test="$subtitle">
41    <h3 class="subtitle">
42      <i>
43        <xsl:apply-templates select="$node" mode="object.subtitle.markup"/>
44      </i>
45    </h3>
46  </xsl:if>
47</xsl:template>
48
49<xsl:template name="component.separator">
50</xsl:template>
51
52<!-- ==================================================================== -->
53
54<xsl:template match="dedication" mode="dedication">
55  <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
56  <div id="{$id}" class="{name(.)}">
57    <xsl:call-template name="dedication.titlepage"/>
58    <xsl:apply-templates/>
59    <xsl:call-template name="process.footnotes"/>
60  </div>
61</xsl:template>
62
63<xsl:template match="title" mode="dedication.titlepage.recto.mode">
64  <xsl:call-template name="component.title">
65    <xsl:with-param name="node" select="ancestor::dedication[1]"/>
66  </xsl:call-template>
67</xsl:template>
68
69<xsl:template match="subtitle" mode="dedication.titlepage.recto.mode">
70  <xsl:call-template name="component.subtitle">
71    <xsl:with-param name="node" select="ancestor::dedication[1]"/>
72  </xsl:call-template>
73</xsl:template>
74
75<xsl:template match="dedication"></xsl:template> <!-- see mode="dedication" -->
76<xsl:template match="dedication/title"></xsl:template>
77<xsl:template match="dedication/subtitle"></xsl:template>
78<xsl:template match="dedication/titleabbrev"></xsl:template>
79
80<!-- ==================================================================== -->
81
82<xsl:template match="colophon">
83  <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
84  <div id="{$id}" class="{name(.)}">
85    <xsl:call-template name="component.separator"/>
86    <xsl:call-template name="component.title"/>
87    <xsl:call-template name="component.subtitle"/>
88
89    <xsl:apply-templates/>
90    <xsl:call-template name="process.footnotes"/>
91  </div>
92</xsl:template>
93
94<xsl:template match="colophon/title"></xsl:template>
95
96<!-- ==================================================================== -->
97
98<xsl:template match="preface">
99  <xsl:variable name="id">
100    <xsl:call-template name="object.id"/>
101  </xsl:variable>
102
103  <div id="{$id}" class="{name(.)}">
104    <xsl:call-template name="component.separator"/>
105    <xsl:call-template name="preface.titlepage"/>
106    <xsl:if test="$generate.preface.toc != '0'">
107      <xsl:call-template name="component.toc"/>
108    </xsl:if>
109    <xsl:apply-templates/>
110    <xsl:call-template name="process.footnotes"/>
111  </div>
112</xsl:template>
113
114<xsl:template match="title" mode="preface.titlepage.recto.mode">
115  <xsl:call-template name="component.title">
116    <xsl:with-param name="node" select="ancestor::preface[1]"/>
117  </xsl:call-template>
118</xsl:template>
119
120<xsl:template match="subtitle" mode="preface.titlepage.recto.mode">
121  <xsl:call-template name="component.subtitle">
122    <xsl:with-param name="node" select="ancestor::preface[1]"/>
123  </xsl:call-template>
124</xsl:template>
125
126<xsl:template match="preface/docinfo|prefaceinfo"></xsl:template>
127<xsl:template match="preface/title"></xsl:template>
128<xsl:template match="preface/titleabbrev"></xsl:template>
129<xsl:template match="preface/subtitle"></xsl:template>
130
131<!-- ==================================================================== -->
132
133<xsl:template match="chapter">
134  <xsl:variable name="id">
135    <xsl:call-template name="object.id"/>
136  </xsl:variable>
137
138  <div class="{name(.)}">
139    <xsl:call-template name="component.separator"/>
140    <xsl:call-template name="chapter.titlepage"/>
141    <xsl:if test="$generate.chapter.toc != '0'">
142      <xsl:call-template name="component.toc"/>
143    </xsl:if>
144    <xsl:apply-templates/>
145    <xsl:call-template name="process.footnotes"/>
146  </div>
147</xsl:template>
148
149<xsl:template match="title" mode="chapter.titlepage.recto.mode">
150  <xsl:call-template name="component.title">
151    <xsl:with-param name="node" select="ancestor::chapter[1]"/>
152  </xsl:call-template>
153</xsl:template>
154
155<xsl:template match="subtitle" mode="chapter.titlepage.recto.mode">
156  <xsl:call-template name="component.subtitle">
157    <xsl:with-param name="node" select="ancestor::chapter[1]"/>
158  </xsl:call-template>
159</xsl:template>
160
161<xsl:template match="chapter/docinfo|chapterinfo"></xsl:template>
162<xsl:template match="chapter/title"></xsl:template>
163<xsl:template match="chapter/titleabbrev"></xsl:template>
164<xsl:template match="chapter/subtitle"></xsl:template>
165
166<!-- ==================================================================== -->
167
168<xsl:template match="appendix">
169  <xsl:variable name="id">
170    <xsl:call-template name="object.id"/>
171  </xsl:variable>
172
173  <div class="{name(.)}">
174    <xsl:call-template name="component.separator"/>
175    <xsl:call-template name="appendix.titlepage"/>
176    <xsl:if test="$generate.appendix.toc != '0'">
177      <xsl:call-template name="component.toc"/>
178    </xsl:if>
179    <xsl:apply-templates/>
180    <xsl:call-template name="process.footnotes"/>
181  </div>
182</xsl:template>
183
184<xsl:template match="article/appendix">
185  <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
186
187  <div class="{name(.)}">
188    <xsl:call-template name="section.heading">
189      <xsl:with-param name="level" select="2"/>
190      <xsl:with-param name="title">
191        <xsl:apply-templates select="." mode="object.title.markup"/>
192      </xsl:with-param>
193    </xsl:call-template>
194
195    <xsl:apply-templates/>
196  </div>
197</xsl:template>
198
199<xsl:template match="title" mode="appendix.titlepage.recto.mode">
200  <xsl:call-template name="component.title">
201    <xsl:with-param name="node" select="ancestor::appendix[1]"/>
202  </xsl:call-template>
203</xsl:template>
204
205<xsl:template match="subtitle" mode="appendix.titlepage.recto.mode">
206  <xsl:call-template name="component.subtitle">
207    <xsl:with-param name="node" select="ancestor::appendix[1]"/>
208  </xsl:call-template>
209</xsl:template>
210
211<xsl:template match="appendix/docinfo|appendixinfo"></xsl:template>
212<xsl:template match="appendix/title"></xsl:template>
213<xsl:template match="appendix/titleabbrev"></xsl:template>
214<xsl:template match="appendix/subtitle"></xsl:template>
215
216<!-- ==================================================================== -->
217
218<xsl:template match="dedication" mode="component.number">
219  <xsl:param name="add.space" select="false()"/>
220</xsl:template>
221
222<xsl:template match="preface" mode="component.number">
223  <xsl:param name="add.space" select="false()"/>
224</xsl:template>
225
226<xsl:template match="chapter" mode="component.number">
227  <xsl:param name="add.space" select="false()"/>
228
229  <xsl:choose>
230    <xsl:when test="@label">
231      <xsl:value-of select="@label"/>
232      <xsl:text>.</xsl:text>
233      <xsl:if test="$add.space">
234        <xsl:call-template name="gentext.space"/>
235      </xsl:if>
236    </xsl:when>
237    <xsl:when test="$chapter.autolabel">
238      <xsl:number from="book" count="chapter" format="1."/>
239      <xsl:if test="$add.space">
240        <xsl:call-template name="gentext.space"/>
241      </xsl:if>
242    </xsl:when>
243    <xsl:otherwise></xsl:otherwise>
244  </xsl:choose>
245</xsl:template>
246
247<xsl:template match="appendix" mode="component.number">
248  <xsl:param name="add.space" select="false()"/>
249
250  <xsl:choose>
251    <xsl:when test="@label">
252      <xsl:value-of select="@label"/>
253      <xsl:text>.</xsl:text>
254      <xsl:if test="$add.space">
255        <xsl:call-template name="gentext.space"/>
256      </xsl:if>
257    </xsl:when>
258    <xsl:when test="$chapter.autolabel">
259      <xsl:number from="book" count="appendix" format="A."/>
260      <xsl:if test="$add.space">
261        <xsl:call-template name="gentext.space"/>
262      </xsl:if>
263    </xsl:when>
264    <xsl:otherwise></xsl:otherwise>
265  </xsl:choose>
266</xsl:template>
267
268<xsl:template match="article" mode="component.number">
269  <xsl:param name="add.space" select="false()"/>
270</xsl:template>
271
272<xsl:template match="bibliography" mode="component.number">
273  <xsl:param name="add.space" select="false()"/>
274</xsl:template>
275
276<xsl:template match="glossary" mode="component.number">
277  <xsl:param name="add.space" select="false()"/>
278</xsl:template>
279
280<xsl:template match="index" mode="component.number">
281  <xsl:param name="add.space" select="false()"/>
282</xsl:template>
283
284<!-- ==================================================================== -->
285
286<xsl:template match="article">
287  <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
288  <div class="{name(.)}">
289    <xsl:call-template name="article.titlepage"/>
290    <xsl:if test="$generate.article.toc != '0'">
291      <xsl:call-template name="component.toc"/>
292    </xsl:if>
293    <xsl:apply-templates/>
294    <xsl:call-template name="process.footnotes"/>
295  </div>
296</xsl:template>
297
298<xsl:template match="title" mode="article.titlepage.recto.mode">
299  <xsl:call-template name="component.title">
300    <xsl:with-param name="node" select="ancestor::article[1]"/>
301  </xsl:call-template>
302</xsl:template>
303
304<xsl:template match="subtitle" mode="article.titlepage.recto.mode">
305  <xsl:call-template name="component.subtitle">
306    <xsl:with-param name="node" select="ancestor::article[1]"/>
307  </xsl:call-template>
308</xsl:template>
309
310<xsl:template match="article/artheader|article/articleinfo"></xsl:template>
311<xsl:template match="article/title"></xsl:template>
312<xsl:template match="article/titleabbrev"></xsl:template>
313<xsl:template match="article/subtitle"></xsl:template>
314
315<!-- ==================================================================== -->
316
317</xsl:stylesheet>
318
319