]> git.evergreen-ils.org Git - working/Evergreen.git/blob - stylesheets/evergreen_docbook_files/docbook-xsl-1.75.2/html/component.xsl
Add stylesheets for our evergreen docbook site.
[working/Evergreen.git] / stylesheets / evergreen_docbook_files / docbook-xsl-1.75.2 / html / component.xsl
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 8421 2009-05-04 07:49:49Z 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 <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: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"/>
43       </xsl:call-template>
44     </xsl:if>
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"
54                 select="($node/docinfo/subtitle
55                         |$node/info/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]"/>
62
63   <xsl:if test="$subtitle">
64     <h3 class="subtitle">
65       <i>
66         <xsl:apply-templates select="$node" mode="object.subtitle.markup"/>
67       </i>
68     </h3>
69   </xsl:if>
70 </xsl:template>
71
72 <xsl:template name="component.separator">
73 </xsl:template>
74
75 <!-- ==================================================================== -->
76
77 <xsl:template match="dedication" mode="dedication">
78   <xsl:call-template name="id.warning"/>
79
80   <div>
81     <xsl:call-template name="common.html.attributes">
82       <xsl:with-param name="inherit" select="1"/>
83     </xsl:call-template>
84     <xsl:call-template name="dedication.titlepage"/>
85     <xsl:apply-templates/>
86     <xsl:call-template name="process.footnotes"/>
87   </div>
88 </xsl:template>
89
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]"/>
94   </xsl:call-template>
95 </xsl:template>
96
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]"/>
101   </xsl:call-template>
102 </xsl:template>
103
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>
108
109 <!-- ==================================================================== -->
110
111 <xsl:template match="acknowledgements" mode="acknowledgements">
112   <xsl:call-template name="id.warning"/>
113
114   <div>
115     <xsl:call-template name="common.html.attributes">
116       <xsl:with-param name="inherit" select="1"/>
117     </xsl:call-template>
118     <xsl:call-template name="acknowledgements.titlepage"/>
119     <xsl:apply-templates/>
120     <xsl:call-template name="process.footnotes"/>
121   </div>
122 </xsl:template>
123
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]"/>
128   </xsl:call-template>
129 </xsl:template>
130
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]"/>
135   </xsl:call-template>
136 </xsl:template>
137
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>
142
143 <!-- ==================================================================== -->
144
145 <xsl:template match="colophon">
146   <xsl:call-template name="id.warning"/>
147
148   <div>
149     <xsl:call-template name="common.html.attributes">
150       <xsl:with-param name="inherit" select="1"/>
151     </xsl:call-template>
152     <xsl:if test="$generate.id.attributes != 0">
153       <xsl:attribute name="id">
154         <xsl:call-template name="object.id"/>
155       </xsl:attribute>
156     </xsl:if>
157
158     <xsl:call-template name="component.separator"/>
159     <xsl:call-template name="component.title"/>
160     <xsl:call-template name="component.subtitle"/>
161
162     <xsl:apply-templates/>
163     <xsl:call-template name="process.footnotes"/>
164   </div>
165 </xsl:template>
166
167 <xsl:template match="colophon/title"></xsl:template>
168 <xsl:template match="colophon/subtitle"></xsl:template>
169 <xsl:template match="colophon/titleabbrev"></xsl:template>
170
171 <!-- ==================================================================== -->
172
173 <xsl:template match="preface">
174   <xsl:call-template name="id.warning"/>
175
176   <div>
177     <xsl:call-template name="common.html.attributes">
178       <xsl:with-param name="inherit" select="1"/>
179     </xsl:call-template>
180     <xsl:if test="$generate.id.attributes != 0">
181       <xsl:attribute name="id">
182         <xsl:call-template name="object.id"/>
183       </xsl:attribute>
184     </xsl:if>
185
186     <xsl:call-template name="component.separator"/>
187     <xsl:call-template name="preface.titlepage"/>
188
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)"/>
192       </xsl:call-template>
193     </xsl:variable>
194
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')"/>
198       </xsl:call-template>
199       <xsl:call-template name="component.toc.separator"/>
200     </xsl:if>
201     <xsl:apply-templates/>
202     <xsl:call-template name="process.footnotes"/>
203   </div>
204 </xsl:template>
205
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]"/>
209   </xsl:call-template>
210 </xsl:template>
211
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]"/>
219   </xsl:call-template>
220 </xsl:template>
221
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>
227
228 <!-- ==================================================================== -->
229
230 <xsl:template match="chapter">
231   <xsl:call-template name="id.warning"/>
232
233   <div>
234     <xsl:call-template name="common.html.attributes">
235       <xsl:with-param name="inherit" select="1"/>
236     </xsl:call-template>
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:call-template name="component.separator"/>
244     <xsl:call-template name="chapter.titlepage"/>
245
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)"/>
249       </xsl:call-template>
250     </xsl:variable>
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')"/>
254       </xsl:call-template>
255       <xsl:call-template name="component.toc.separator"/>
256     </xsl:if>
257     <xsl:apply-templates/>
258     <xsl:call-template name="process.footnotes"/>
259   </div>
260 </xsl:template>
261
262 <xsl:template match="chapter/title|chapter/chapterinfo/title"
263               mode="titlepage.mode" priority="2">
264   <xsl:call-template name="component.title">
265     <xsl:with-param name="node" select="ancestor::chapter[1]"/>
266   </xsl:call-template>
267 </xsl:template>
268
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]"/>
276   </xsl:call-template>
277 </xsl:template>
278
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>
284
285 <!-- ==================================================================== -->
286
287 <xsl:template match="appendix">
288   <xsl:variable name="ischunk">
289     <xsl:call-template name="chunk"/>
290   </xsl:variable>
291
292   <xsl:call-template name="id.warning"/>
293
294   <div>
295     <xsl:call-template name="common.html.attributes">
296       <xsl:with-param name="inherit" select="1"/>
297     </xsl:call-template>
298     <xsl:if test="$generate.id.attributes != 0">
299       <xsl:attribute name="id">
300         <xsl:call-template name="object.id"/>
301       </xsl:attribute>
302     </xsl:if>
303
304     <xsl:choose>
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"/>
310           </xsl:with-param>
311         </xsl:call-template>
312       </xsl:when>
313       <xsl:otherwise>
314         <xsl:call-template name="component.separator"/>
315         <xsl:call-template name="appendix.titlepage"/>
316       </xsl:otherwise>
317     </xsl:choose>
318
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)"/>
322       </xsl:call-template>
323     </xsl:variable>
324
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')"/>
328       </xsl:call-template>
329       <xsl:call-template name="component.toc.separator"/>
330     </xsl:if>
331
332     <xsl:apply-templates/>
333
334     <xsl:if test="not(parent::article) or $ischunk != 0">
335       <xsl:call-template name="process.footnotes"/>
336     </xsl:if>
337   </div>
338 </xsl:template>
339
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]"/>
344   </xsl:call-template>
345 </xsl:template>
346
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]"/>
354   </xsl:call-template>
355 </xsl:template>
356
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>
362
363 <!-- ==================================================================== -->
364
365 <xsl:template match="article">
366   <xsl:call-template name="id.warning"/>
367
368   <div>
369     <xsl:call-template name="common.html.attributes">
370       <xsl:with-param name="inherit" select="1"/>
371     </xsl:call-template>
372     <xsl:if test="$generate.id.attributes != 0">
373       <xsl:attribute name="id">
374         <xsl:call-template name="object.id"/>
375       </xsl:attribute>
376     </xsl:if>
377
378     <xsl:call-template name="article.titlepage"/>
379
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)"/>
383       </xsl:call-template>
384     </xsl:variable>
385
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')"/>
391         </xsl:call-template>
392       </xsl:with-param>
393     </xsl:call-template>
394
395     <xsl:apply-templates/>
396     <xsl:call-template name="process.footnotes"/>
397   </div>
398 </xsl:template>
399
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]"/>
403   </xsl:call-template>
404 </xsl:template>
405
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]"/>
413   </xsl:call-template>
414 </xsl:template>
415
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>
421
422 <!-- ==================================================================== -->
423
424 </xsl:stylesheet>
425