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