Rocco Rutte:
[apps/madmutt.git] / doc / xslt / xhtml / component.xsl
1 <?xml version="1.0" encoding="US-ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets. Do not edit this file.-->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
5
6 <!-- ********************************************************************
7      $Id$
8      ********************************************************************
9
10      This file is part of the XSL DocBook Stylesheet distribution.
11      See ../README or http://nwalsh.com/docbook/xsl/ for copyright
12      and other information.
13
14      ******************************************************************** -->
15
16 <!-- ==================================================================== -->
17
18 <xsl:template name="component.title">
19   <xsl:param name="node" select="."/>
20
21   <xsl:variable name="level">
22     <xsl:choose>
23       <xsl:when test="ancestor::section">
24         <xsl:value-of select="count(ancestor::section)+1"/>
25       </xsl:when>
26       <xsl:when test="ancestor::sect5">6</xsl:when>
27       <xsl:when test="ancestor::sect4">5</xsl:when>
28       <xsl:when test="ancestor::sect3">4</xsl:when>
29       <xsl:when test="ancestor::sect2">3</xsl:when>
30       <xsl:when test="ancestor::sect1">2</xsl:when>
31       <xsl:otherwise>1</xsl:otherwise>
32     </xsl:choose>
33   </xsl:variable>
34
35   <!-- Let's handle the case where a component (bibliography, for example)
36        occurs inside a section; will we need parameters for this? -->
37
38   <xsl:element name="h{$level+1}" namespace="http://www.w3.org/1999/xhtml">
39     <xsl:attribute name="class">title</xsl:attribute>
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:apply-templates select="$node" mode="object.title.markup">
45       <xsl:with-param name="allow-anchors" select="1"/>
46     </xsl:apply-templates>
47   </xsl:element>
48 </xsl:template>
49
50 <xsl:template name="component.subtitle">
51   <xsl:param name="node" select="."/>
52   <xsl:variable name="subtitle" select="($node/docinfo/subtitle                         |$node/info/subtitle                         |$node/prefaceinfo/subtitle                         |$node/chapterinfo/subtitle                         |$node/appendixinfo/subtitle                         |$node/articleinfo/subtitle                         |$node/artheader/subtitle                         |$node/subtitle)[1]"/>
53
54   <xsl:if test="$subtitle">
55     <h3 class="subtitle">
56       <i>
57         <xsl:apply-templates select="$node" mode="object.subtitle.markup"/>
58       </i>
59     </h3>
60   </xsl:if>
61 </xsl:template>
62
63 <xsl:template name="component.separator">
64 </xsl:template>
65
66 <!-- ==================================================================== -->
67
68 <xsl:template match="dedication" mode="dedication">
69   <div class="{name(.)}">
70     <xsl:call-template name="language.attribute"/>
71     <xsl:call-template name="dedication.titlepage"/>
72     <xsl:apply-templates/>
73     <xsl:call-template name="process.footnotes"/>
74   </div>
75 </xsl:template>
76
77 <xsl:template match="dedication/title" mode="titlepage.mode" priority="2">
78   <xsl:call-template name="component.title">
79     <xsl:with-param name="node" select="ancestor::dedication[1]"/>
80   </xsl:call-template>
81 </xsl:template>
82
83 <xsl:template match="dedication/subtitle" mode="titlepage.mode" priority="2">
84   <xsl:call-template name="component.subtitle">
85     <xsl:with-param name="node" select="ancestor::dedication[1]"/>
86   </xsl:call-template>
87 </xsl:template>
88
89 <xsl:template match="dedication"/> <!-- see mode="dedication" -->
90 <xsl:template match="dedication/title"/>
91 <xsl:template match="dedication/subtitle"/>
92 <xsl:template match="dedication/titleabbrev"/>
93
94 <!-- ==================================================================== -->
95
96 <xsl:template match="colophon">
97   <div class="{name(.)}">
98     <xsl:call-template name="language.attribute"/>
99     <xsl:if test="$generate.id.attributes != 0">
100       <xsl:attribute name="id">
101         <xsl:call-template name="object.id"/>
102       </xsl:attribute>
103     </xsl:if>
104
105     <xsl:call-template name="component.separator"/>
106     <xsl:call-template name="component.title"/>
107     <xsl:call-template name="component.subtitle"/>
108
109     <xsl:apply-templates/>
110     <xsl:call-template name="process.footnotes"/>
111   </div>
112 </xsl:template>
113
114 <xsl:template match="colophon/title"/>
115 <xsl:template match="colophon/subtitle"/>
116 <xsl:template match="colophon/titleabbrev"/>
117
118 <!-- ==================================================================== -->
119
120 <xsl:template match="preface">
121   <div class="{name(.)}">
122     <xsl:call-template name="language.attribute"/>
123     <xsl:if test="$generate.id.attributes != 0">
124       <xsl:attribute name="id">
125         <xsl:call-template name="object.id"/>
126       </xsl:attribute>
127     </xsl:if>
128
129     <xsl:call-template name="component.separator"/>
130     <xsl:call-template name="preface.titlepage"/>
131
132     <xsl:variable name="toc.params">
133       <xsl:call-template name="find.path.params">
134         <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
135       </xsl:call-template>
136     </xsl:variable>
137
138     <xsl:if test="contains($toc.params, 'toc')">
139       <xsl:call-template name="component.toc">
140         <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
141       </xsl:call-template>
142       <xsl:call-template name="component.toc.separator"/>
143     </xsl:if>
144     <xsl:apply-templates/>
145     <xsl:call-template name="process.footnotes"/>
146   </div>
147 </xsl:template>
148
149 <xsl:template match="preface/title" mode="titlepage.mode" priority="2">
150   <xsl:call-template name="component.title">
151     <xsl:with-param name="node" select="ancestor::preface[1]"/>
152   </xsl:call-template>
153 </xsl:template>
154
155 <xsl:template match="preface/subtitle                      |preface/prefaceinfo/subtitle                      |preface/info/subtitle                      |preface/docinfo/subtitle" mode="titlepage.mode" priority="2">
156   <xsl:call-template name="component.subtitle">
157     <xsl:with-param name="node" select="ancestor::preface[1]"/>
158   </xsl:call-template>
159 </xsl:template>
160
161 <xsl:template match="preface/docinfo|prefaceinfo"/>
162 <xsl:template match="preface/title"/>
163 <xsl:template match="preface/titleabbrev"/>
164 <xsl:template match="preface/subtitle"/>
165
166 <!-- ==================================================================== -->
167
168 <xsl:template match="chapter">
169   <div class="{name(.)}">
170     <xsl:call-template name="language.attribute"/>
171     <xsl:if test="$generate.id.attributes != 0">
172       <xsl:attribute name="id">
173         <xsl:call-template name="object.id"/>
174       </xsl:attribute>
175     </xsl:if>
176
177     <xsl:call-template name="component.separator"/>
178     <xsl:call-template name="chapter.titlepage"/>
179
180     <xsl:variable name="toc.params">
181       <xsl:call-template name="find.path.params">
182         <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
183       </xsl:call-template>
184     </xsl:variable>
185     <xsl:if test="contains($toc.params, 'toc')">
186       <xsl:call-template name="component.toc">
187         <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
188       </xsl:call-template>
189       <xsl:call-template name="component.toc.separator"/>
190     </xsl:if>
191     <xsl:apply-templates/>
192     <xsl:call-template name="process.footnotes"/>
193   </div>
194 </xsl:template>
195
196 <xsl:template match="chapter/title" mode="titlepage.mode" priority="2">
197   <xsl:call-template name="component.title">
198     <xsl:with-param name="node" select="ancestor::chapter[1]"/>
199   </xsl:call-template>
200 </xsl:template>
201
202 <xsl:template match="chapter/subtitle                      |chapter/chapterinfo/subtitle                      |chapter/info/subtitle                      |chapter/docinfo/subtitle" mode="titlepage.mode" priority="2">
203   <xsl:call-template name="component.subtitle">
204     <xsl:with-param name="node" select="ancestor::chapter[1]"/>
205   </xsl:call-template>
206 </xsl:template>
207
208 <xsl:template match="chapter/docinfo|chapterinfo"/>
209 <xsl:template match="chapter/title"/>
210 <xsl:template match="chapter/titleabbrev"/>
211 <xsl:template match="chapter/subtitle"/>
212
213 <!-- ==================================================================== -->
214
215 <xsl:template match="appendix">
216   <xsl:variable name="ischunk">
217     <xsl:call-template name="chunk"/>
218   </xsl:variable>
219
220   <div class="{name(.)}">
221     <xsl:call-template name="language.attribute"/>
222     <xsl:if test="$generate.id.attributes != 0">
223       <xsl:attribute name="id">
224         <xsl:call-template name="object.id"/>
225       </xsl:attribute>
226     </xsl:if>
227
228     <xsl:choose>
229       <xsl:when test="parent::article and $ischunk = 0">
230         <xsl:call-template name="section.heading">
231           <xsl:with-param name="level" select="1"/>
232           <xsl:with-param name="title">
233             <xsl:apply-templates select="." mode="object.title.markup"/>
234           </xsl:with-param>
235         </xsl:call-template>
236       </xsl:when>
237       <xsl:otherwise>
238         <xsl:call-template name="component.separator"/>
239         <xsl:call-template name="appendix.titlepage"/>
240       </xsl:otherwise>
241     </xsl:choose>
242
243     <xsl:variable name="toc.params">
244       <xsl:call-template name="find.path.params">
245         <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
246       </xsl:call-template>
247     </xsl:variable>
248
249     <xsl:if test="contains($toc.params, 'toc')">
250       <xsl:call-template name="component.toc">
251         <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
252       </xsl:call-template>
253       <xsl:call-template name="component.toc.separator"/>
254     </xsl:if>
255
256     <xsl:apply-templates/>
257
258     <xsl:if test="not(parent::article) or $ischunk != 0">
259       <xsl:call-template name="process.footnotes"/>
260     </xsl:if>
261   </div>
262 </xsl:template>
263
264 <xsl:template match="appendix/title" mode="titlepage.mode" priority="2">
265   <xsl:call-template name="component.title">
266     <xsl:with-param name="node" select="ancestor::appendix[1]"/>
267   </xsl:call-template>
268 </xsl:template>
269
270 <xsl:template match="appendix/subtitle                      |appendix/appendixinfo/subtitle                      |appendix/info/subtitle                      |appendix/docinfo/subtitle" mode="titlepage.mode" priority="2">
271   <xsl:call-template name="component.subtitle">
272     <xsl:with-param name="node" select="ancestor::appendix[1]"/>
273   </xsl:call-template>
274 </xsl:template>
275
276 <xsl:template match="appendix/docinfo|appendixinfo"/>
277 <xsl:template match="appendix/title"/>
278 <xsl:template match="appendix/titleabbrev"/>
279 <xsl:template match="appendix/subtitle"/>
280
281 <!-- ==================================================================== -->
282
283 <xsl:template match="article">
284   <div class="{name(.)}">
285     <xsl:call-template name="language.attribute"/>
286     <xsl:if test="$generate.id.attributes != 0">
287       <xsl:attribute name="id">
288         <xsl:call-template name="object.id"/>
289       </xsl:attribute>
290     </xsl:if>
291
292     <xsl:call-template name="article.titlepage"/>
293
294     <xsl:variable name="toc.params">
295       <xsl:call-template name="find.path.params">
296         <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
297       </xsl:call-template>
298     </xsl:variable>
299
300     <xsl:call-template name="make.lots">
301       <xsl:with-param name="toc.params" select="$toc.params"/>
302       <xsl:with-param name="toc">
303         <xsl:call-template name="component.toc">
304           <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
305         </xsl:call-template>
306       </xsl:with-param>
307     </xsl:call-template>
308
309     <xsl:apply-templates/>
310     <xsl:call-template name="process.footnotes"/>
311   </div>
312 </xsl:template>
313
314 <xsl:template match="article/title" mode="titlepage.mode" priority="2">
315   <xsl:call-template name="component.title">
316     <xsl:with-param name="node" select="ancestor::article[1]"/>
317   </xsl:call-template>
318 </xsl:template>
319
320 <xsl:template match="article/subtitle                      |article/articleinfo/subtitle                      |article/info/subtitle                      |article/artheader/subtitle" mode="titlepage.mode" priority="2">
321   <xsl:call-template name="component.subtitle">
322     <xsl:with-param name="node" select="ancestor::article[1]"/>
323   </xsl:call-template>
324 </xsl:template>
325
326 <xsl:template match="article/artheader|article/articleinfo"/>
327 <xsl:template match="article/title"/>
328 <xsl:template match="article/titleabbrev"/>
329 <xsl:template match="article/subtitle"/>
330
331 <!-- ==================================================================== -->
332
333 </xsl:stylesheet>