blob: 4fa7212832bc1360f193c1dd7428e4bdb78ffd58 [file] [log] [blame]
de97ab7e72005-11-27 18:19:40 +00001<?xml version="1.0"?> <!-- -*- sgml -*- -->
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
4<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
5<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk-common.xsl"/>
6<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/manifest.xsl"/>
7<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk-code.xsl"/>
8
9
debad57fc2005-12-03 22:33:29 +000010<!-- Note [Dec.1 2005]: the tempate 'chunk-code.xsl' in -->
11<!-- '/usr/share/xml/docbook/stylesheet/nwalsh/1.69.0/html/' -->
12<!-- has been edited to remove 'article' and 'refentry' -->
13<!-- so that separate titlepages don't get generated for them -->
sewardj1809cea2006-09-12 22:36:55 +000014<!-- Note [Dec.1 2005, JRS]: ../1.69.0/.. was changed to -->
15<!-- ../current/.. in docs/Makefile.am, since the latter is a -->
16<!-- symlink to the former, at least on SuSE 10.0. -->
debad57fc2005-12-03 22:33:29 +000017
18
de97ab7e72005-11-27 18:19:40 +000019<!-- use 8859-1 encoding -->
20<xsl:output method="html" encoding="ISO-8859-1" indent="yes"/>
21
22<!-- set various parameters -->
23<xsl:param name="use.id.as.filename" select="'1'"/>
24<xsl:param name="chunker.output.indent" select="'yes'"/>
25<!-- set chunking at the chapter level only -->
26<xsl:param name="chunk.section.depth" select="'0'"/>
27<!-- set toc-levels -->
28<xsl:param name="generate.toc">
29set toc,title
30book toc,title,figure,table,example,equation
31chapter toc,title
32section toc
33sect1 toc
34sect2 toc
35sect3 toc
36sect4 nop
37sect5 nop
38qandaset toc
39qandadiv toc
40appendix toc,title
41article/appendix nop
42article nop
43preface toc,title
44reference toc,title
45</xsl:param>
46
47
48<!-- properties common to html + fo ................................... -->
49
50<!-- we like '1.2 Title' -->
51<xsl:param name="section.autolabel" select="'1'"/>
52<xsl:param name="section.label.includes.component.label" select="'1'"/>
53
54<!-- Do not put 'Chapter' at the start of eg 'Chapter 1. Doing This' -->
55<xsl:param name="local.l10n.xml" select="document('')"/>
56<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
57 <l:l10n language="en">
58 <l:context name="title-numbered">
59 <l:template name="chapter" text="%n.&#160;%t"/>
60 </l:context>
61 </l:l10n>
62</l:i18n>
63
64<!-- per Bob Stayton: turn off xml:base processing pro tem -->
65<!-- should hopefully be fixed in next docbook stylesheets release (1.70) -->
66<xsl:template match="@fileref">
67 <xsl:value-of select="."/>
68</xsl:template>
69
70<!-- end properties common to html + fo ............................... -->
71
72
73<!-- center everything at the top of a titlepage -->
74<xsl:attribute-set name="set.titlepage.recto.style">
75 <xsl:attribute name="align">center</xsl:attribute>
76</xsl:attribute-set>
77
78
79<!-- don`t put an expanded set-level TOC, only book titles -->
80<xsl:template match="book" mode="toc">
81 <xsl:param name="toc-context" select="."/>
82 <xsl:choose>
83 <xsl:when test="local-name($toc-context) = 'set'">
84 <xsl:call-template name="subtoc">
85 <xsl:with-param name="toc-context" select="$toc-context"/>
86 <xsl:with-param name="nodes" select="foo"/>
87 </xsl:call-template>
88 </xsl:when>
89 <xsl:otherwise>
90 <xsl:call-template name="subtoc">
91 <xsl:with-param name="toc-context" select="$toc-context"/>
92 <xsl:with-param name="nodes" select="part|reference
93 |preface|chapter|appendix
94 |article
95 |bibliography|glossary|index
96 |refentry
97 |bridgehead[$bridgehead.in.toc !=
980]"/>
99 </xsl:call-template>
100 </xsl:otherwise>
101 </xsl:choose>
102</xsl:template>
103
104
105<!-- custom footer -->
106<xsl:template name="footer.navigation">
107 <xsl:param name="prev" select="/foo"/>
108 <xsl:param name="next" select="/foo"/>
109 <xsl:param name="nav.context"/>
110
111 <xsl:variable name="home" select="/*[1]"/>
112 <xsl:variable name="up" select="parent::*"/>
113
114 <xsl:variable name="row1" select="count($prev) &gt; 0
115 or count($up) &gt; 0
116 or count($next) &gt; 0"/>
117
118 <xsl:variable name="row2" select="($prev != 0)
119 or (generate-id($home) != generate-id(.) or $nav.context = 'toc')
120 or ($chunk.tocs.and.lots != 0 and $nav.context != 'toc')
121 or ($next != 0)"/>
122 <div>
123 <xsl:if test="$row1 or $row2">
124 <br />
125 <table class="nav" width="100%" cellspacing="3" cellpadding="2" border="0" summary="Navigation footer">
126 <xsl:if test="$row1">
127 <tr>
128 <td rowspan="2" width="40%" align="left">
129 <xsl:if test="count($prev)>0">
130 <a accesskey="p">
131 <xsl:attribute name="href">
132 <xsl:call-template name="href.target">
133 <xsl:with-param name="object" select="$prev"/>
134 </xsl:call-template>
135 </xsl:attribute>
136 <xsl:text>&#060;&#060;&#160;</xsl:text>
137 <xsl:apply-templates select="$prev" mode="object.title.markup"/>
138 </a>
139 </xsl:if>
140 <xsl:text>&#160;</xsl:text>
141 </td>
142 <td width="20%" align="center">
143 <xsl:choose>
144 <xsl:when test="count($up)>0">
145 <a accesskey="u">
146 <xsl:attribute name="href">
147 <xsl:call-template name="href.target">
148 <xsl:with-param name="object" select="$up"/>
149 </xsl:call-template>
150 </xsl:attribute>
151 <xsl:call-template name="navig.content">
152 <xsl:with-param name="direction" select="'up'"/>
153 </xsl:call-template>
154 </a>
155 </xsl:when>
156 <xsl:otherwise>&#160;</xsl:otherwise>
157 </xsl:choose>
158 </td>
159 <td rowspan="2" width="40%" align="right">
160 <xsl:text>&#160;</xsl:text>
161 <xsl:if test="count($next)>0">
162 <a accesskey="n">
163 <xsl:attribute name="href">
164 <xsl:call-template name="href.target">
165 <xsl:with-param name="object" select="$next"/>
166 </xsl:call-template>
167 </xsl:attribute>
168 <xsl:apply-templates select="$next" mode="object.title.markup"/>
169 <xsl:text>&#160;&#062;&#062;</xsl:text>
170 </a>
171 </xsl:if>
172 </td>
173 </tr>
174 </xsl:if>
175 <xsl:if test="$row2">
176 <tr>
177 <td width="20%" align="center">
178 <xsl:choose>
179 <xsl:when test="$home != . or $nav.context = 'toc'">
180 <a accesskey="h">
181 <xsl:attribute name="href">
182 <xsl:call-template name="href.target">
183 <xsl:with-param name="object" select="$home"/>
184 </xsl:call-template>
185 </xsl:attribute>
186 <xsl:call-template name="navig.content">
187 <xsl:with-param name="direction" select="'home'"/>
188 </xsl:call-template>
189 </a>
190 <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
191 <xsl:text>&#160;|&#160;</xsl:text>
192 </xsl:if>
193 </xsl:when>
194 <xsl:otherwise>&#160;</xsl:otherwise>
195 </xsl:choose>
196 <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
197 <a accesskey="t">
198 <xsl:attribute name="href">
199 <xsl:apply-templates select="/*[1]" mode="recursive-chunk-filename"/>
200 <xsl:text>-toc</xsl:text>
201 <xsl:value-of select="$html.ext"/>
202 </xsl:attribute>
203 <xsl:call-template name="gentext">
204 <xsl:with-param name="key" select="'nav-toc'"/>
205 </xsl:call-template>
206 </a>
207 </xsl:if>
208 </td>
209 </tr>
210 </xsl:if>
211 </table>
212 </xsl:if>
213 </div>
214</xsl:template>
215
216
217<!-- qandaset styles -->
218<!-- these templates have been carefully tweaked to correct the -->
219<!-- horrible mess that docbook makes of dl/dt/dd tags. Edit with care -->
220<xsl:template match="qandaset">
221 <xsl:variable name="title" select="(blockinfo/title|title)[1]"/>
222 <xsl:variable name="toc">
223 <xsl:call-template name="dbhtml-attribute">
224 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
225 <xsl:with-param name="attribute" select="'toc'"/>
226 </xsl:call-template>
227 </xsl:variable>
228
229 <xsl:variable name="toc.params">
230 <xsl:call-template name="find.path.params">
231 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
232 </xsl:call-template>
233 </xsl:variable>
234
235 <div class="{name(.)}">
236 <xsl:apply-templates select="$title"/>
237 <xsl:if test="(contains($toc.params, 'toc') and $toc != '0') or $toc = '1'">
238 <xsl:call-template name="process.qanda.toc"/>
239 </xsl:if>
240 <xsl:apply-templates select="qandaentry|qandadiv"/>
241 </div>
242</xsl:template>
243
244
245<xsl:template match="qandadiv">
246 <br/>
247 <table width="100%" summary="Q and A Div" cellpadding="2" cellspacing="2" border="0">
248 <xsl:if test="blockinfo/title|title">
249 <tr class="qandadiv">
250 <td align="left" valign="top" colspan="2">
251 <xsl:call-template name="anchor">
252 <xsl:with-param name="conditional" select="0"/>
253 </xsl:call-template>
254 <xsl:apply-templates select="(blockinfo/title|title)[1]"/>
255 </td>
256 </tr>
257 </xsl:if>
258
259 <xsl:variable name="toc">
260 <xsl:call-template name="dbhtml-attribute">
261 <xsl:with-param name="pis"
262 select="processing-instruction('dbhtml')"/>
263 <xsl:with-param name="attribute" select="'toc'"/>
264 </xsl:call-template>
265 </xsl:variable>
266
267 <xsl:variable name="toc.params">
268 <xsl:call-template name="find.path.params">
269 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
270 </xsl:call-template>
271 </xsl:variable>
272
273 <xsl:if test="(contains($toc.params, 'toc') and $toc != '0') or $toc = '1'">
274 <tr class="toc" colspan="2">
275 <td align="left" valign="top" colspan="2">
276 <xsl:call-template name="process.myqanda.toc"/>
277 </td>
278 </tr>
279 </xsl:if>
280 <xsl:apply-templates select="qandadiv|qandaentry"/>
281 </table>
282</xsl:template>
283
284
285<!-- put questions in bold -->
286<xsl:template match="question/para">
287 <b><xsl:apply-templates/></b>
288</xsl:template>
289
290<xsl:template match="question">
291 <xsl:variable name="deflabel">
292 <xsl:choose>
293 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
294 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
295 /@defaultlabel"/>
296 </xsl:when>
297 <xsl:otherwise>
298 <xsl:value-of select="$qanda.defaultlabel"/>
299 </xsl:otherwise>
300 </xsl:choose>
301 </xsl:variable>
302 <tr><td colspan="2"><xsl:text>&#160;</xsl:text></td></tr>
303 <tr class="{name(.)}">
304 <td align="left" valign="top">
305 <xsl:call-template name="anchor">
306 <xsl:with-param name="node" select=".."/>
307 <xsl:with-param name="conditional" select="0"/>
308 </xsl:call-template>
309 <xsl:call-template name="anchor">
310 <xsl:with-param name="conditional" select="0"/>
311 </xsl:call-template>
312 <b>
313 <xsl:apply-templates select="." mode="label.markup"/>
314 <xsl:if test="$deflabel = 'number' and not(label)">
315 <xsl:apply-templates select="." mode="intralabel.punctuation"/>
316 </xsl:if>
317 </b>
318 </td>
319 <td align="left" valign="top">
320 <xsl:choose>
321 <xsl:when test="$deflabel = 'none' and not(label)">
322 <b><xsl:apply-templates select="*[name(.) != 'label']"/></b>
323 </xsl:when>
324 <xsl:otherwise>
325 <xsl:apply-templates select="*[name(.) != 'label']"/>
326 </xsl:otherwise>
327 </xsl:choose>
328 </td>
329 </tr>
330</xsl:template>
331
332
333<xsl:template name="process.myqanda.toc">
334 <xsl:apply-templates select="qandadiv" mode="qandatoc.mode"/>
335 <xsl:apply-templates select="qandaentry" mode="myqandatoc.mode"/>
336</xsl:template>
337
338
339<xsl:template name="process.qanda.toc">
340 <xsl:apply-templates select="qandadiv" mode="qandatoc.mode"/>
341 <xsl:apply-templates select="qandaentry" mode="qandatoc.mode"/>
342</xsl:template>
343
344
345<xsl:template match="qandadiv" mode="qandatoc.mode">
346<dl>
347 <dt><xsl:apply-templates select="title" mode="qandatoc.mode"/></dt>
348 <xsl:call-template name="process.qanda.toc"/>
349</dl>
350</xsl:template>
351
352
353<!-- this one is used at the top of the page -->
354<xsl:template match="question" mode="qandatoc.mode">
355 <xsl:variable name="firstch" select="(*[name(.)!='label'])[1]"/>
356 <xsl:variable name="deflabel">
357 <xsl:choose>
358 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
359 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
360 /@defaultlabel"/>
361 </xsl:when>
362 <xsl:otherwise>
363 <xsl:value-of select="$qanda.defaultlabel"/>
364 </xsl:otherwise>
365 </xsl:choose>
366 </xsl:variable>
367 <dd>
368 <xsl:apply-templates select="." mode="label.markup"/>
369 <xsl:if test="$deflabel = 'number' and not(label)">
370 <xsl:apply-templates select="." mode="intralabel.punctuation"/>
371 </xsl:if>
372 <xsl:text> </xsl:text>
373 <a>
374 <xsl:attribute name="href">
375 <xsl:call-template name="href.target">
376 <xsl:with-param name="object" select=".."/>
377 </xsl:call-template>
378 </xsl:attribute>
379 <xsl:value-of select="$firstch"/>
380 </a>
381 </dd>
382</xsl:template>
383
384
385<!-- this one is used within table cells -->
386<xsl:template match="qandaentry" mode="myqandatoc.mode">
387 <xsl:apply-templates select="question" mode="myqandatoc.mode"/>
388</xsl:template>
389
390<xsl:template match="question" mode="myqandatoc.mode">
391 <xsl:variable name="firstch" select="(*[name(.)!='label'])[1]"/>
392 <xsl:variable name="deflabel">
393 <xsl:choose>
394 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
395 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
396 /@defaultlabel"/>
397 </xsl:when>
398 <xsl:otherwise>
399 <xsl:value-of select="$qanda.defaultlabel"/>
400 </xsl:otherwise>
401 </xsl:choose>
402 </xsl:variable>
403 <xsl:apply-templates select="." mode="label.markup"/>
404 <xsl:if test="$deflabel = 'number' and not(label)">
405 <xsl:apply-templates select="." mode="intralabel.punctuation"/>
406 </xsl:if>
407 <xsl:text> </xsl:text>
408 <a>
409 <xsl:attribute name="href">
410 <xsl:call-template name="href.target">
411 <xsl:with-param name="object" select=".."/>
412 </xsl:call-template>
413 </xsl:attribute>
414 <xsl:value-of select="$firstch"/>
415 </a>
416 <br />
417</xsl:template>
418
419
420</xsl:stylesheet>