1
<?xml version="1.0"?> <!-- -*- sgml -*- -->
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
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"/>
10
<!-- 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 -->
16
<!-- use 8859-1 encoding -->
17
<xsl:output method="html" encoding="ISO-8859-1" indent="yes"/>
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">
27
book toc,title,figure,table,example,equation
45
<!-- properties common to html + fo ................................... -->
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'"/>
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. %t"/>
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="."/>
67
<!-- end properties common to html + fo ............................... -->
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>
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="."/>
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"/>
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
92
|bibliography|glossary|index
94
|bridgehead[$bridgehead.in.toc !=
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"/>
108
<xsl:variable name="home" select="/*[1]"/>
109
<xsl:variable name="up" select="parent::*"/>
111
<xsl:variable name="row1" select="count($prev) > 0
113
or count($next) > 0"/>
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')
120
<xsl:if test="$row1 or $row2">
122
<table class="nav" width="100%" cellspacing="3" cellpadding="2" border="0" summary="Navigation footer">
123
<xsl:if test="$row1">
125
<td rowspan="2" width="40%" align="left">
126
<xsl:if test="count($prev)>0">
128
<xsl:attribute name="href">
129
<xsl:call-template name="href.target">
130
<xsl:with-param name="object" select="$prev"/>
133
<xsl:text><< </xsl:text>
134
<xsl:apply-templates select="$prev" mode="object.title.markup"/>
137
<xsl:text> </xsl:text>
139
<td width="20%" align="center">
141
<xsl:when test="count($up)>0">
143
<xsl:attribute name="href">
144
<xsl:call-template name="href.target">
145
<xsl:with-param name="object" select="$up"/>
148
<xsl:call-template name="navig.content">
149
<xsl:with-param name="direction" select="'up'"/>
153
<xsl:otherwise> </xsl:otherwise>
156
<td rowspan="2" width="40%" align="right">
157
<xsl:text> </xsl:text>
158
<xsl:if test="count($next)>0">
160
<xsl:attribute name="href">
161
<xsl:call-template name="href.target">
162
<xsl:with-param name="object" select="$next"/>
165
<xsl:apply-templates select="$next" mode="object.title.markup"/>
166
<xsl:text> >></xsl:text>
172
<xsl:if test="$row2">
174
<td width="20%" align="center">
176
<xsl:when test="$home != . or $nav.context = 'toc'">
178
<xsl:attribute name="href">
179
<xsl:call-template name="href.target">
180
<xsl:with-param name="object" select="$home"/>
183
<xsl:call-template name="navig.content">
184
<xsl:with-param name="direction" select="'home'"/>
187
<xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
188
<xsl:text> | </xsl:text>
191
<xsl:otherwise> </xsl:otherwise>
193
<xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
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"/>
200
<xsl:call-template name="gentext">
201
<xsl:with-param name="key" select="'nav-toc'"/>
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'"/>
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)"/>
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"/>
237
<xsl:apply-templates select="qandaentry|qandadiv"/>
242
<xsl:template match="qandadiv">
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"/>
251
<xsl:apply-templates select="(blockinfo/title|title)[1]"/>
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'"/>
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)"/>
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"/>
277
<xsl:apply-templates select="qandadiv|qandaentry"/>
282
<!-- put questions in bold -->
283
<xsl:template match="question/para">
284
<b><xsl:apply-templates/></b>
287
<xsl:template match="question">
288
<xsl:variable name="deflabel">
290
<xsl:when test="ancestor-or-self::*[@defaultlabel]">
291
<xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
295
<xsl:value-of select="$qanda.defaultlabel"/>
299
<tr><td colspan="2"><xsl:text> </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"/>
306
<xsl:call-template name="anchor">
307
<xsl:with-param name="conditional" select="0"/>
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"/>
316
<td align="left" valign="top">
318
<xsl:when test="$deflabel = 'none' and not(label)">
319
<b><xsl:apply-templates select="*[name(.) != 'label']"/></b>
322
<xsl:apply-templates select="*[name(.) != 'label']"/>
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"/>
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"/>
342
<xsl:template match="qandadiv" mode="qandatoc.mode">
344
<dt><xsl:apply-templates select="title" mode="qandatoc.mode"/></dt>
345
<xsl:call-template name="process.qanda.toc"/>
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">
355
<xsl:when test="ancestor-or-self::*[@defaultlabel]">
356
<xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
360
<xsl:value-of select="$qanda.defaultlabel"/>
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"/>
369
<xsl:text> </xsl:text>
371
<xsl:attribute name="href">
372
<xsl:call-template name="href.target">
373
<xsl:with-param name="object" select=".."/>
376
<xsl:value-of select="$firstch"/>
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"/>
387
<xsl:template match="question" mode="myqandatoc.mode">
388
<xsl:variable name="firstch" select="(*[name(.)!='label'])[1]"/>
389
<xsl:variable name="deflabel">
391
<xsl:when test="ancestor-or-self::*[@defaultlabel]">
392
<xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
396
<xsl:value-of select="$qanda.defaultlabel"/>
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"/>
404
<xsl:text> </xsl:text>
406
<xsl:attribute name="href">
407
<xsl:call-template name="href.target">
408
<xsl:with-param name="object" select=".."/>
411
<xsl:value-of select="$firstch"/>