Whamcloud - gitweb
LUDOC-11 osc: document tunable parameters
[doc/manual.git] / webhelp / xhtml / component.xsl
1 <?xml version="1.0" encoding="ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets.-->
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: component.xsl 9500 2012-07-15 23:24:21Z bobstayton $
8      ********************************************************************
9
10      This file is part of the XSL DocBook Stylesheet distribution.
11      See ../README or http://docbook.sf.net/release/xsl/current/ for
12      copyright and other information.
13
14      ******************************************************************** -->
15
16 <!-- ==================================================================== -->
17
18 <!-- Set to 2 for backwards compatibility -->
19 <xsl:param name="component.heading.level" select="2"/>
20
21 <xsl:template name="component.title">
22   <xsl:param name="node" select="."/>
23
24   <!-- This handles the case where a component (bibliography, for example)
25        occurs inside a section; will we need parameters for this? -->
26
27   <!-- This "level" is a section level.  To compute <h> level, add 1. -->
28   <xsl:variable name="level">
29     <xsl:choose>
30       <!-- chapters and other book children should get <h1> -->
31       <xsl:when test="$node/parent::book">0</xsl:when>
32       <xsl:when test="ancestor::section">
33         <xsl:value-of select="count(ancestor::section)+1"/>
34       </xsl:when>
35       <xsl:when test="ancestor::sect5">6</xsl:when>
36       <xsl:when test="ancestor::sect4">5</xsl:when>
37       <xsl:when test="ancestor::sect3">4</xsl:when>
38       <xsl:when test="ancestor::sect2">3</xsl:when>
39       <xsl:when test="ancestor::sect1">2</xsl:when>
40       <xsl:otherwise>1</xsl:otherwise>
41     </xsl:choose>
42   </xsl:variable>
43
44   <xsl:element name="h{$level+1}" namespace="http://www.w3.org/1999/xhtml">
45     <xsl:attribute name="class">title</xsl:attribute>
46     <xsl:call-template name="anchor">
47       <xsl:with-param name="node" select="$node"/>
48       <xsl:with-param name="conditional" select="0"/>
49     </xsl:call-template>
50     <xsl:apply-templates select="$node" mode="object.title.markup">
51       <xsl:with-param name="allow-anchors" select="1"/>
52     </xsl:apply-templates>
53   </xsl:element>
54 </xsl:template>
55
56 <xsl:template name="component.subtitle">
57   <xsl:param name="node" select="."/>
58   <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]"/>
59
60   <xsl:if test="$subtitle">
61     <h3 class="subtitle">
62       <xsl:call-template name="id.attribute"/>
63       <em xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
64         <xsl:apply-templates select="$node" mode="object.subtitle.markup"/>
65       </em>
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   <xsl:call-template name="id.warning"/>
77
78   <div>
79     <xsl:call-template name="common.html.attributes">
80       <xsl:with-param name="inherit" select="1"/>
81     </xsl:call-template>
82     <xsl:call-template name="id.attribute">
83       <xsl:with-param name="conditional" select="0"/>
84     </xsl:call-template>
85     <xsl:call-template name="dedication.titlepage"/>
86     <xsl:apply-templates/>
87     <xsl:call-template name="process.footnotes"/>
88   </div>
89 </xsl:template>
90
91 <xsl:template match="dedication/title|dedication/info/title" 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" mode="titlepage.mode" priority="2">
98   <xsl:call-template name="component.subtitle">
99     <xsl:with-param name="node" select="ancestor::dedication[1]"/>
100   </xsl:call-template>
101 </xsl:template>
102
103 <xsl:template match="dedication"/> <!-- see mode="dedication" -->
104 <xsl:template match="dedication/title"/>
105 <xsl:template match="dedication/subtitle"/>
106 <xsl:template match="dedication/titleabbrev"/>
107
108 <!-- ==================================================================== -->
109
110 <xsl:template match="acknowledgements" mode="acknowledgements">
111   <xsl:call-template name="id.warning"/>
112
113   <div>
114     <xsl:call-template name="common.html.attributes">
115       <xsl:with-param name="inherit" select="1"/>
116     </xsl:call-template>
117     <xsl:call-template name="id.attribute">
118       <xsl:with-param name="conditional" select="0"/>
119     </xsl:call-template>
120     <xsl:call-template name="acknowledgements.titlepage"/>
121     <xsl:apply-templates/>
122     <xsl:call-template name="process.footnotes"/>
123   </div>
124 </xsl:template>
125
126 <xsl:template match="acknowledgements/title|acknowledgements/info/title" mode="titlepage.mode" priority="2">
127   <xsl:call-template name="component.title">
128     <xsl:with-param name="node" select="ancestor::acknowledgements[1]"/>
129   </xsl:call-template>
130 </xsl:template>
131
132 <xsl:template match="acknowledgements/subtitle|acknowledgements/info/subtitle" 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"/> <!-- see mode="acknowledgements" -->
139 <xsl:template match="acknowledgements/title"/>
140 <xsl:template match="acknowledgements/subtitle"/>
141 <xsl:template match="acknowledgements/titleabbrev"/>
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:call-template name="id.attribute">
153       <xsl:with-param name="conditional" select="0"/>
154     </xsl:call-template>
155
156     <xsl:call-template name="component.separator"/>
157     <xsl:call-template name="component.title"/>
158     <xsl:call-template name="component.subtitle"/>
159
160     <xsl:apply-templates/>
161     <xsl:call-template name="process.footnotes"/>
162   </div>
163 </xsl:template>
164
165 <xsl:template match="colophon/title"/>
166 <xsl:template match="colophon/subtitle"/>
167 <xsl:template match="colophon/titleabbrev"/>
168
169 <!-- ==================================================================== -->
170
171 <xsl:template match="preface">
172   <xsl:call-template name="id.warning"/>
173
174   <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml">
175     <xsl:call-template name="common.html.attributes">
176       <xsl:with-param name="inherit" select="1"/>
177     </xsl:call-template>
178     <xsl:call-template name="id.attribute">
179       <xsl:with-param name="conditional" select="0"/>
180     </xsl:call-template>
181
182     <xsl:call-template name="component.separator"/>
183     <xsl:call-template name="preface.titlepage"/>
184
185     <xsl:variable name="toc.params">
186       <xsl:call-template name="find.path.params">
187         <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
188       </xsl:call-template>
189     </xsl:variable>
190
191     <xsl:if test="contains($toc.params, 'toc')">
192       <xsl:call-template name="component.toc">
193         <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
194       </xsl:call-template>
195       <xsl:call-template name="component.toc.separator"/>
196     </xsl:if>
197     <xsl:apply-templates/>
198     <xsl:call-template name="process.footnotes"/>
199   </xsl:element>
200 </xsl:template>
201
202 <xsl:template match="preface/title" mode="titlepage.mode" priority="2">
203   <xsl:call-template name="component.title">
204     <xsl:with-param name="node" select="ancestor::preface[1]"/>
205   </xsl:call-template>
206 </xsl:template>
207
208 <xsl:template match="preface/subtitle                      |preface/prefaceinfo/subtitle                      |preface/info/subtitle                      |preface/docinfo/subtitle" mode="titlepage.mode" priority="2">
209   <xsl:call-template name="component.subtitle">
210     <xsl:with-param name="node" select="ancestor::preface[1]"/>
211   </xsl:call-template>
212 </xsl:template>
213
214 <xsl:template match="preface/docinfo|prefaceinfo"/>
215 <xsl:template match="preface/info"/>
216 <xsl:template match="preface/title"/>
217 <xsl:template match="preface/titleabbrev"/>
218 <xsl:template match="preface/subtitle"/>
219
220 <!-- ==================================================================== -->
221
222 <xsl:template match="chapter">
223   <xsl:call-template name="id.warning"/>
224
225   <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml">
226     <xsl:call-template name="common.html.attributes">
227       <xsl:with-param name="inherit" select="1"/>
228     </xsl:call-template>
229     <xsl:call-template name="id.attribute">
230       <xsl:with-param name="conditional" select="0"/>
231     </xsl:call-template>
232
233     <xsl:call-template name="component.separator"/>
234     <xsl:call-template name="chapter.titlepage"/>
235
236     <xsl:variable name="toc.params">
237       <xsl:call-template name="find.path.params">
238         <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
239       </xsl:call-template>
240     </xsl:variable>
241     <xsl:if test="contains($toc.params, 'toc')">
242       <xsl:call-template name="component.toc">
243         <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
244       </xsl:call-template>
245       <xsl:call-template name="component.toc.separator"/>
246     </xsl:if>
247     <xsl:apply-templates/>
248     <xsl:call-template name="process.footnotes"/>
249   </xsl:element>
250 </xsl:template>
251
252 <xsl:template match="chapter/title|chapter/chapterinfo/title|chapter/info/title" mode="titlepage.mode" priority="2">
253   <xsl:call-template name="component.title">
254     <xsl:with-param name="node" select="ancestor::chapter[1]"/>
255   </xsl:call-template>
256 </xsl:template>
257
258 <xsl:template match="chapter/subtitle                      |chapter/chapterinfo/subtitle                      |chapter/info/subtitle                      |chapter/docinfo/subtitle" mode="titlepage.mode" priority="2">
259   <xsl:call-template name="component.subtitle">
260     <xsl:with-param name="node" select="ancestor::chapter[1]"/>
261   </xsl:call-template>
262 </xsl:template>
263
264 <xsl:template match="chapter/docinfo|chapterinfo"/>
265 <xsl:template match="chapter/info"/>
266 <xsl:template match="chapter/title"/>
267 <xsl:template match="chapter/titleabbrev"/>
268 <xsl:template match="chapter/subtitle"/>
269
270 <!-- ==================================================================== -->
271
272 <xsl:template match="appendix">
273   <xsl:variable name="ischunk">
274     <xsl:call-template name="chunk"/>
275   </xsl:variable>
276
277   <xsl:call-template name="id.warning"/>
278
279   <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml">
280     <xsl:call-template name="common.html.attributes">
281       <xsl:with-param name="inherit" select="1"/>
282     </xsl:call-template>
283     <xsl:call-template name="id.attribute">
284       <xsl:with-param name="conditional" select="0"/>
285     </xsl:call-template>
286
287     <xsl:choose>
288       <xsl:when test="parent::article and $ischunk = 0">
289         <xsl:call-template name="section.heading">
290           <xsl:with-param name="level" select="1"/>
291           <xsl:with-param name="title">
292             <xsl:apply-templates select="." mode="object.title.markup"/>
293           </xsl:with-param>
294         </xsl:call-template>
295       </xsl:when>
296       <xsl:otherwise>
297         <xsl:call-template name="component.separator"/>
298         <xsl:call-template name="appendix.titlepage"/>
299       </xsl:otherwise>
300     </xsl:choose>
301
302     <xsl:variable name="toc.params">
303       <xsl:call-template name="find.path.params">
304         <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
305       </xsl:call-template>
306     </xsl:variable>
307
308     <xsl:if test="contains($toc.params, 'toc')">
309       <xsl:call-template name="component.toc">
310         <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
311       </xsl:call-template>
312       <xsl:call-template name="component.toc.separator"/>
313     </xsl:if>
314
315     <xsl:apply-templates/>
316
317     <xsl:if test="not(parent::article) or $ischunk != 0">
318       <xsl:call-template name="process.footnotes"/>
319     </xsl:if>
320   </xsl:element>
321 </xsl:template>
322
323 <xsl:template match="appendix/title|appendix/appendixinfo/title" mode="titlepage.mode" priority="2">
324   <xsl:call-template name="component.title">
325     <xsl:with-param name="node" select="ancestor::appendix[1]"/>
326   </xsl:call-template>
327 </xsl:template>
328
329 <xsl:template match="appendix/subtitle                      |appendix/appendixinfo/subtitle                      |appendix/info/subtitle                      |appendix/docinfo/subtitle" mode="titlepage.mode" priority="2">
330   <xsl:call-template name="component.subtitle">
331     <xsl:with-param name="node" select="ancestor::appendix[1]"/>
332   </xsl:call-template>
333 </xsl:template>
334
335 <xsl:template match="appendix/docinfo|appendixinfo"/>
336 <xsl:template match="appendix/info"/>
337 <xsl:template match="appendix/title"/>
338 <xsl:template match="appendix/titleabbrev"/>
339 <xsl:template match="appendix/subtitle"/>
340
341 <!-- ==================================================================== -->
342
343 <xsl:template match="article">
344   <xsl:call-template name="id.warning"/>
345
346   <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml">
347     <xsl:call-template name="common.html.attributes">
348       <xsl:with-param name="inherit" select="1"/>
349     </xsl:call-template>
350     <xsl:call-template name="id.attribute">
351       <xsl:with-param name="conditional" select="0"/>
352     </xsl:call-template>
353
354     <xsl:call-template name="article.titlepage"/>
355
356     <xsl:variable name="toc.params">
357       <xsl:call-template name="find.path.params">
358         <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
359       </xsl:call-template>
360     </xsl:variable>
361
362     <xsl:call-template name="make.lots">
363       <xsl:with-param name="toc.params" select="$toc.params"/>
364       <xsl:with-param name="toc">
365         <xsl:call-template name="component.toc">
366           <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
367         </xsl:call-template>
368       </xsl:with-param>
369     </xsl:call-template>
370
371     <xsl:apply-templates/>
372     <xsl:call-template name="process.footnotes"/>
373   </xsl:element>
374 </xsl:template>
375
376 <xsl:template match="article/title|article/articleinfo/title" mode="titlepage.mode" priority="2">
377   <xsl:call-template name="component.title">
378     <xsl:with-param name="node" select="ancestor::article[1]"/>
379   </xsl:call-template>
380 </xsl:template>
381
382 <xsl:template match="article/subtitle                      |article/articleinfo/subtitle                      |article/info/subtitle                      |article/artheader/subtitle" mode="titlepage.mode" priority="2">
383   <xsl:call-template name="component.subtitle">
384     <xsl:with-param name="node" select="ancestor::article[1]"/>
385   </xsl:call-template>
386 </xsl:template>
387
388 <xsl:template match="article/artheader|article/articleinfo"/>
389 <xsl:template match="article/info"/>
390 <xsl:template match="article/title"/>
391 <xsl:template match="article/titleabbrev"/>
392 <xsl:template match="article/subtitle"/>
393
394 <!-- ==================================================================== -->
395
396 <xsl:template match="topic">
397   <xsl:call-template name="id.warning"/>
398
399   <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml">
400     <xsl:call-template name="common.html.attributes">
401       <xsl:with-param name="inherit" select="1"/>
402     </xsl:call-template>
403     <xsl:call-template name="id.attribute">
404       <xsl:with-param name="conditional" select="0"/>
405     </xsl:call-template>
406
407     <xsl:call-template name="topic.titlepage"/>
408
409     <xsl:variable name="toc.params">
410       <xsl:call-template name="find.path.params">
411         <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
412       </xsl:call-template>
413     </xsl:variable>
414
415     <xsl:apply-templates/>
416
417     <xsl:call-template name="process.footnotes"/>
418   </xsl:element>
419 </xsl:template>
420
421 <xsl:template match="topic/title|topic/info/title" mode="titlepage.mode" priority="2">
422   <xsl:call-template name="component.title">
423     <xsl:with-param name="node" select="ancestor::topic[1]"/>
424   </xsl:call-template>
425 </xsl:template>
426
427 <xsl:template match="topic/subtitle                      |topic/info/subtitle" mode="titlepage.mode" priority="2">
428   <xsl:call-template name="component.subtitle">
429     <xsl:with-param name="node" select="ancestor::topic[1]"/>
430   </xsl:call-template>
431 </xsl:template>
432
433 <xsl:template match="topic/info"/>
434 <xsl:template match="topic/title"/>
435 <xsl:template match="topic/titleabbrev"/>
436 <xsl:template match="topic/subtitle"/>
437
438 </xsl:stylesheet>