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