1
|
<?xml version='1.0'?>
|
2
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
3
|
xmlns:ng="http://docbook.org/docbook-ng"
|
4
|
xmlns:db="http://docbook.org/ns/docbook"
|
5
|
xmlns:exsl="http://exslt.org/common"
|
6
|
xmlns:exslt="http://exslt.org/common"
|
7
|
exclude-result-prefixes="db ng exsl exslt"
|
8
|
version='1.0'>
|
9
|
|
10
|
<xsl:output method="html"
|
11
|
encoding="ISO-8859-1"
|
12
|
indent="no"/>
|
13
|
|
14
|
<!-- ********************************************************************
|
15
|
$Id: docbook.xsl 8399 2009-04-08 07:37:42Z bobstayton $
|
16
|
********************************************************************
|
17
|
|
18
|
This file is part of the XSL DocBook Stylesheet distribution.
|
19
|
See ../README or http://docbook.sf.net/release/xsl/current/ for
|
20
|
copyright and other information.
|
21
|
|
22
|
******************************************************************** -->
|
23
|
|
24
|
<!-- ==================================================================== -->
|
25
|
|
26
|
<xsl:include href="../VERSION"/>
|
27
|
<xsl:include href="param.xsl"/>
|
28
|
<xsl:include href="../lib/lib.xsl"/>
|
29
|
<xsl:include href="../common/l10n.xsl"/>
|
30
|
<xsl:include href="../common/common.xsl"/>
|
31
|
<xsl:include href="../common/utility.xsl"/>
|
32
|
<xsl:include href="../common/labels.xsl"/>
|
33
|
<xsl:include href="../common/titles.xsl"/>
|
34
|
<xsl:include href="../common/subtitles.xsl"/>
|
35
|
<xsl:include href="../common/gentext.xsl"/>
|
36
|
<xsl:include href="../common/targets.xsl"/>
|
37
|
<xsl:include href="../common/olink.xsl"/>
|
38
|
<xsl:include href="../common/pi.xsl"/>
|
39
|
<xsl:include href="autotoc.xsl"/>
|
40
|
<xsl:include href="autoidx.xsl"/>
|
41
|
<xsl:include href="lists.xsl"/>
|
42
|
<xsl:include href="callout.xsl"/>
|
43
|
<xsl:include href="verbatim.xsl"/>
|
44
|
<xsl:include href="graphics.xsl"/>
|
45
|
<xsl:include href="xref.xsl"/>
|
46
|
<xsl:include href="formal.xsl"/>
|
47
|
<xsl:include href="table.xsl"/>
|
48
|
<xsl:include href="htmltbl.xsl"/>
|
49
|
<xsl:include href="sections.xsl"/>
|
50
|
<xsl:include href="inline.xsl"/>
|
51
|
<xsl:include href="footnote.xsl"/>
|
52
|
<xsl:include href="html.xsl"/>
|
53
|
<xsl:include href="info.xsl"/>
|
54
|
<xsl:include href="keywords.xsl"/>
|
55
|
<xsl:include href="division.xsl"/>
|
56
|
<xsl:include href="toc.xsl"/>
|
57
|
<xsl:include href="index.xsl"/>
|
58
|
<xsl:include href="refentry.xsl"/>
|
59
|
<xsl:include href="math.xsl"/>
|
60
|
<xsl:include href="admon.xsl"/>
|
61
|
<xsl:include href="component.xsl"/>
|
62
|
<xsl:include href="biblio.xsl"/>
|
63
|
<xsl:include href="biblio-iso690.xsl"/>
|
64
|
<xsl:include href="glossary.xsl"/>
|
65
|
<xsl:include href="block.xsl"/>
|
66
|
<xsl:include href="task.xsl"/>
|
67
|
<xsl:include href="qandaset.xsl"/>
|
68
|
<xsl:include href="synop.xsl"/>
|
69
|
<xsl:include href="titlepage.xsl"/>
|
70
|
<xsl:include href="titlepage.templates.xsl"/>
|
71
|
<xsl:include href="pi.xsl"/>
|
72
|
<xsl:include href="ebnf.xsl"/>
|
73
|
<xsl:include href="chunker.xsl"/>
|
74
|
<xsl:include href="html-rtf.xsl"/>
|
75
|
<xsl:include href="annotations.xsl"/>
|
76
|
<xsl:include href="../common/stripns.xsl"/>
|
77
|
|
78
|
<xsl:param name="stylesheet.result.type" select="'html'"/>
|
79
|
<xsl:param name="htmlhelp.output" select="0"/>
|
80
|
|
81
|
<!-- ==================================================================== -->
|
82
|
|
83
|
<xsl:key name="id" match="*" use="@id|@xml:id"/>
|
84
|
<xsl:key name="gid" match="*" use="generate-id()"/>
|
85
|
|
86
|
<!-- ==================================================================== -->
|
87
|
|
88
|
<xsl:template match="*">
|
89
|
<xsl:message>
|
90
|
<xsl:text>Element </xsl:text>
|
91
|
<xsl:value-of select="local-name(.)"/>
|
92
|
<xsl:text> in namespace '</xsl:text>
|
93
|
<xsl:value-of select="namespace-uri(.)"/>
|
94
|
<xsl:text>' encountered</xsl:text>
|
95
|
<xsl:if test="parent::*">
|
96
|
<xsl:text> in </xsl:text>
|
97
|
<xsl:value-of select="name(parent::*)"/>
|
98
|
</xsl:if>
|
99
|
<xsl:text>, but no template matches.</xsl:text>
|
100
|
</xsl:message>
|
101
|
|
102
|
<span style="color: red">
|
103
|
<xsl:text><</xsl:text>
|
104
|
<xsl:value-of select="name(.)"/>
|
105
|
<xsl:text>></xsl:text>
|
106
|
<xsl:apply-templates/>
|
107
|
<xsl:text></</xsl:text>
|
108
|
<xsl:value-of select="name(.)"/>
|
109
|
<xsl:text>></xsl:text>
|
110
|
</span>
|
111
|
</xsl:template>
|
112
|
|
113
|
<xsl:template match="text()">
|
114
|
<xsl:value-of select="."/>
|
115
|
</xsl:template>
|
116
|
|
117
|
<xsl:template name="body.attributes">
|
118
|
<xsl:attribute name="bgcolor">white</xsl:attribute>
|
119
|
<xsl:attribute name="text">black</xsl:attribute>
|
120
|
<xsl:attribute name="link">#0000FF</xsl:attribute>
|
121
|
<xsl:attribute name="vlink">#840084</xsl:attribute>
|
122
|
<xsl:attribute name="alink">#0000FF</xsl:attribute>
|
123
|
<xsl:if test="starts-with($writing.mode, 'rl')">
|
124
|
<xsl:attribute name="dir">rtl</xsl:attribute>
|
125
|
</xsl:if>
|
126
|
</xsl:template>
|
127
|
|
128
|
<xsl:template name="head.content">
|
129
|
<xsl:param name="node" select="."/>
|
130
|
<xsl:param name="title">
|
131
|
<xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
|
132
|
</xsl:param>
|
133
|
|
134
|
<title>
|
135
|
<xsl:copy-of select="$title"/>
|
136
|
</title>
|
137
|
|
138
|
<xsl:if test="$html.stylesheet != ''">
|
139
|
<xsl:call-template name="output.html.stylesheets">
|
140
|
<xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/>
|
141
|
</xsl:call-template>
|
142
|
</xsl:if>
|
143
|
|
144
|
<xsl:if test="$link.mailto.url != ''">
|
145
|
<link rev="made"
|
146
|
href="{$link.mailto.url}"/>
|
147
|
</xsl:if>
|
148
|
|
149
|
<xsl:if test="$html.base != ''">
|
150
|
<base href="{$html.base}"/>
|
151
|
</xsl:if>
|
152
|
|
153
|
<meta name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/>
|
154
|
|
155
|
<xsl:if test="$generate.meta.abstract != 0">
|
156
|
<xsl:variable name="info" select="(articleinfo
|
157
|
|bookinfo
|
158
|
|prefaceinfo
|
159
|
|chapterinfo
|
160
|
|appendixinfo
|
161
|
|sectioninfo
|
162
|
|sect1info
|
163
|
|sect2info
|
164
|
|sect3info
|
165
|
|sect4info
|
166
|
|sect5info
|
167
|
|referenceinfo
|
168
|
|refentryinfo
|
169
|
|partinfo
|
170
|
|info
|
171
|
|docinfo)[1]"/>
|
172
|
<xsl:if test="$info and $info/abstract">
|
173
|
<meta name="description">
|
174
|
<xsl:attribute name="content">
|
175
|
<xsl:for-each select="$info/abstract[1]/*">
|
176
|
<xsl:value-of select="normalize-space(.)"/>
|
177
|
<xsl:if test="position() < last()">
|
178
|
<xsl:text> </xsl:text>
|
179
|
</xsl:if>
|
180
|
</xsl:for-each>
|
181
|
</xsl:attribute>
|
182
|
</meta>
|
183
|
</xsl:if>
|
184
|
</xsl:if>
|
185
|
|
186
|
<xsl:if test="($draft.mode = 'yes' or
|
187
|
($draft.mode = 'maybe' and
|
188
|
ancestor-or-self::*[@status][1]/@status = 'draft'))
|
189
|
and $draft.watermark.image != ''">
|
190
|
<style type="text/css"><xsl:text>
|
191
|
body { background-image: url('</xsl:text>
|
192
|
<xsl:value-of select="$draft.watermark.image"/><xsl:text>');
|
193
|
background-repeat: no-repeat;
|
194
|
background-position: top left;
|
195
|
/* The following properties make the watermark "fixed" on the page. */
|
196
|
/* I think that's just a bit too distracting for the reader... */
|
197
|
/* background-attachment: fixed; */
|
198
|
/* background-position: center center; */
|
199
|
}</xsl:text>
|
200
|
</style>
|
201
|
</xsl:if>
|
202
|
<xsl:apply-templates select="." mode="head.keywords.content"/>
|
203
|
</xsl:template>
|
204
|
|
205
|
<xsl:template name="output.html.stylesheets">
|
206
|
<xsl:param name="stylesheets" select="''"/>
|
207
|
|
208
|
<xsl:choose>
|
209
|
<xsl:when test="contains($stylesheets, ' ')">
|
210
|
<link rel="stylesheet" href="{substring-before($stylesheets, ' ')}">
|
211
|
<xsl:if test="$html.stylesheet.type != ''">
|
212
|
<xsl:attribute name="type">
|
213
|
<xsl:value-of select="$html.stylesheet.type"/>
|
214
|
</xsl:attribute>
|
215
|
</xsl:if>
|
216
|
</link>
|
217
|
<xsl:call-template name="output.html.stylesheets">
|
218
|
<xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
|
219
|
</xsl:call-template>
|
220
|
</xsl:when>
|
221
|
<xsl:when test="$stylesheets != ''">
|
222
|
<link rel="stylesheet" href="{$stylesheets}">
|
223
|
<xsl:if test="$html.stylesheet.type != ''">
|
224
|
<xsl:attribute name="type">
|
225
|
<xsl:value-of select="$html.stylesheet.type"/>
|
226
|
</xsl:attribute>
|
227
|
</xsl:if>
|
228
|
</link>
|
229
|
</xsl:when>
|
230
|
</xsl:choose>
|
231
|
</xsl:template>
|
232
|
|
233
|
<!-- ============================================================ -->
|
234
|
|
235
|
<xsl:template match="*" mode="head.keywords.content">
|
236
|
<xsl:apply-templates select="chapterinfo/keywordset" mode="html.header"/>
|
237
|
<xsl:apply-templates select="appendixinfo/keywordset" mode="html.header"/>
|
238
|
<xsl:apply-templates select="prefaceinfo/keywordset" mode="html.header"/>
|
239
|
<xsl:apply-templates select="bookinfo/keywordset" mode="html.header"/>
|
240
|
<xsl:apply-templates select="setinfo/keywordset" mode="html.header"/>
|
241
|
<xsl:apply-templates select="articleinfo/keywordset" mode="html.header"/>
|
242
|
<xsl:apply-templates select="artheader/keywordset" mode="html.header"/>
|
243
|
<xsl:apply-templates select="sect1info/keywordset" mode="html.header"/>
|
244
|
<xsl:apply-templates select="sect2info/keywordset" mode="html.header"/>
|
245
|
<xsl:apply-templates select="sect3info/keywordset" mode="html.header"/>
|
246
|
<xsl:apply-templates select="sect4info/keywordset" mode="html.header"/>
|
247
|
<xsl:apply-templates select="sect5info/keywordset" mode="html.header"/>
|
248
|
<xsl:apply-templates select="sectioninfo/keywordset" mode="html.header"/>
|
249
|
<xsl:apply-templates select="refsect1info/keywordset" mode="html.header"/>
|
250
|
<xsl:apply-templates select="refsect2info/keywordset" mode="html.header"/>
|
251
|
<xsl:apply-templates select="refsect3info/keywordset" mode="html.header"/>
|
252
|
<xsl:apply-templates select="bibliographyinfo/keywordset" mode="html.header"/>
|
253
|
<xsl:apply-templates select="glossaryinfo/keywordset" mode="html.header"/>
|
254
|
<xsl:apply-templates select="indexinfo/keywordset" mode="html.header"/>
|
255
|
<xsl:apply-templates select="refentryinfo/keywordset" mode="html.header"/>
|
256
|
<xsl:apply-templates select="partinfo/keywordset" mode="html.header"/>
|
257
|
<xsl:apply-templates select="referenceinfo/keywordset" mode="html.header"/>
|
258
|
<xsl:apply-templates select="docinfo/keywordset" mode="html.header"/>
|
259
|
<xsl:apply-templates select="info/keywordset" mode="html.header"/>
|
260
|
|
261
|
<xsl:if test="$inherit.keywords != 0
|
262
|
and parent::*">
|
263
|
<xsl:apply-templates select="parent::*" mode="head.keywords.content"/>
|
264
|
</xsl:if>
|
265
|
</xsl:template>
|
266
|
|
267
|
<!-- ============================================================ -->
|
268
|
|
269
|
<xsl:template name="system.head.content">
|
270
|
<xsl:param name="node" select="."/>
|
271
|
|
272
|
<!-- FIXME: When chunking, only the annotations actually used
|
273
|
in this chunk should be referenced. I don't think it
|
274
|
does any harm to reference them all, but it adds
|
275
|
unnecessary bloat to each chunk. -->
|
276
|
<xsl:if test="$annotation.support != 0 and //annotation">
|
277
|
<xsl:call-template name="add.annotation.links"/>
|
278
|
<script type="text/javascript">
|
279
|
<xsl:text> // Create PopupWindow objects</xsl:text>
|
280
|
<xsl:for-each select="//annotation">
|
281
|
<xsl:text> var popup_</xsl:text>
|
282
|
<xsl:value-of select="generate-id(.)"/>
|
283
|
<xsl:text> = new PopupWindow("popup-</xsl:text>
|
284
|
<xsl:value-of select="generate-id(.)"/>
|
285
|
<xsl:text>"); </xsl:text>
|
286
|
<xsl:text>popup_</xsl:text>
|
287
|
<xsl:value-of select="generate-id(.)"/>
|
288
|
<xsl:text>.offsetY = 15; </xsl:text>
|
289
|
<xsl:text>popup_</xsl:text>
|
290
|
<xsl:value-of select="generate-id(.)"/>
|
291
|
<xsl:text>.autoHide(); </xsl:text>
|
292
|
</xsl:for-each>
|
293
|
</script>
|
294
|
|
295
|
<style type="text/css">
|
296
|
<xsl:value-of select="$annotation.css"/>
|
297
|
</style>
|
298
|
</xsl:if>
|
299
|
|
300
|
<!-- system.head.content is like user.head.content, except that
|
301
|
it is called before head.content. This is important because it
|
302
|
means, for example, that <style> elements output by system.head.content
|
303
|
have a lower CSS precedence than the users stylesheet. -->
|
304
|
</xsl:template>
|
305
|
|
306
|
<!-- ============================================================ -->
|
307
|
|
308
|
<xsl:template name="user.preroot">
|
309
|
<!-- Pre-root output, can be used to output comments and PIs. -->
|
310
|
<!-- This must not output any element content! -->
|
311
|
</xsl:template>
|
312
|
|
313
|
<xsl:template name="user.head.content">
|
314
|
<xsl:param name="node" select="."/>
|
315
|
</xsl:template>
|
316
|
|
317
|
<xsl:template name="user.header.navigation">
|
318
|
<xsl:param name="node" select="."/>
|
319
|
</xsl:template>
|
320
|
|
321
|
<xsl:template name="user.header.content">
|
322
|
<xsl:param name="node" select="."/>
|
323
|
</xsl:template>
|
324
|
|
325
|
<xsl:template name="user.footer.content">
|
326
|
<xsl:param name="node" select="."/>
|
327
|
</xsl:template>
|
328
|
|
329
|
<xsl:template name="user.footer.navigation">
|
330
|
<xsl:param name="node" select="."/>
|
331
|
</xsl:template>
|
332
|
|
333
|
<xsl:template match="/">
|
334
|
<!-- * Get a title for current doc so that we let the user -->
|
335
|
<!-- * know what document we are processing at this point. -->
|
336
|
<xsl:variable name="doc.title">
|
337
|
<xsl:call-template name="get.doc.title"/>
|
338
|
</xsl:variable>
|
339
|
<xsl:choose>
|
340
|
<!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
|
341
|
toss the namespace and continue. Use the docbook5 namespaced
|
342
|
stylesheets for DocBook5 if you don't want to use this feature.-->
|
343
|
<!-- include extra test for Xalan quirk -->
|
344
|
<xsl:when test="$exsl.node.set.available != 0
|
345
|
and (*/self::ng:* or */self::db:*)">
|
346
|
<xsl:call-template name="log.message">
|
347
|
<xsl:with-param name="level">Note</xsl:with-param>
|
348
|
<xsl:with-param name="source" select="$doc.title"/>
|
349
|
<xsl:with-param name="context-desc">
|
350
|
<xsl:text>namesp. cut</xsl:text>
|
351
|
</xsl:with-param>
|
352
|
<xsl:with-param name="message">
|
353
|
<xsl:text>stripped namespace before processing</xsl:text>
|
354
|
</xsl:with-param>
|
355
|
</xsl:call-template>
|
356
|
<xsl:variable name="nons">
|
357
|
<xsl:apply-templates mode="stripNS"/>
|
358
|
</xsl:variable>
|
359
|
<!--
|
360
|
<xsl:message>Saving stripped document.</xsl:message>
|
361
|
<xsl:call-template name="write.chunk">
|
362
|
<xsl:with-param name="filename" select="'/tmp/stripped.xml'"/>
|
363
|
<xsl:with-param name="method" select="'xml'"/>
|
364
|
<xsl:with-param name="content">
|
365
|
<xsl:copy-of select="exsl:node-set($nons)"/>
|
366
|
</xsl:with-param>
|
367
|
</xsl:call-template>
|
368
|
-->
|
369
|
<xsl:call-template name="log.message">
|
370
|
<xsl:with-param name="level">Note</xsl:with-param>
|
371
|
<xsl:with-param name="source" select="$doc.title"/>
|
372
|
<xsl:with-param name="context-desc">
|
373
|
<xsl:text>namesp. cut</xsl:text>
|
374
|
</xsl:with-param>
|
375
|
<xsl:with-param name="message">
|
376
|
<xsl:text>processing stripped document</xsl:text>
|
377
|
</xsl:with-param>
|
378
|
</xsl:call-template>
|
379
|
<xsl:apply-templates select="exsl:node-set($nons)"/>
|
380
|
</xsl:when>
|
381
|
<!-- Can't process unless namespace removed -->
|
382
|
<xsl:when test="*/self::ng:* or */self::db:*">
|
383
|
<xsl:message terminate="yes">
|
384
|
<xsl:text>Unable to strip the namespace from DB5 document,</xsl:text>
|
385
|
<xsl:text> cannot proceed.</xsl:text>
|
386
|
</xsl:message>
|
387
|
</xsl:when>
|
388
|
<xsl:otherwise>
|
389
|
<xsl:choose>
|
390
|
<xsl:when test="$rootid != ''">
|
391
|
<xsl:choose>
|
392
|
<xsl:when test="count(key('id',$rootid)) = 0">
|
393
|
<xsl:message terminate="yes">
|
394
|
<xsl:text>ID '</xsl:text>
|
395
|
<xsl:value-of select="$rootid"/>
|
396
|
<xsl:text>' not found in document.</xsl:text>
|
397
|
</xsl:message>
|
398
|
</xsl:when>
|
399
|
<xsl:otherwise>
|
400
|
<xsl:if test="$collect.xref.targets = 'yes' or
|
401
|
$collect.xref.targets = 'only'">
|
402
|
<xsl:apply-templates select="key('id', $rootid)"
|
403
|
mode="collect.targets"/>
|
404
|
</xsl:if>
|
405
|
<xsl:if test="$collect.xref.targets != 'only'">
|
406
|
<xsl:apply-templates select="key('id',$rootid)"
|
407
|
mode="process.root"/>
|
408
|
<xsl:if test="$tex.math.in.alt != ''">
|
409
|
<xsl:apply-templates select="key('id',$rootid)"
|
410
|
mode="collect.tex.math"/>
|
411
|
</xsl:if>
|
412
|
</xsl:if>
|
413
|
</xsl:otherwise>
|
414
|
</xsl:choose>
|
415
|
</xsl:when>
|
416
|
<xsl:otherwise>
|
417
|
<xsl:if test="$collect.xref.targets = 'yes' or
|
418
|
$collect.xref.targets = 'only'">
|
419
|
<xsl:apply-templates select="/" mode="collect.targets"/>
|
420
|
</xsl:if>
|
421
|
<xsl:if test="$collect.xref.targets != 'only'">
|
422
|
<xsl:apply-templates select="/" mode="process.root"/>
|
423
|
<xsl:if test="$tex.math.in.alt != ''">
|
424
|
<xsl:apply-templates select="/" mode="collect.tex.math"/>
|
425
|
</xsl:if>
|
426
|
</xsl:if>
|
427
|
</xsl:otherwise>
|
428
|
</xsl:choose>
|
429
|
</xsl:otherwise>
|
430
|
</xsl:choose>
|
431
|
</xsl:template>
|
432
|
|
433
|
<xsl:template match="*" mode="process.root">
|
434
|
<xsl:variable name="doc" select="self::*"/>
|
435
|
|
436
|
<xsl:call-template name="user.preroot"/>
|
437
|
<xsl:call-template name="root.messages"/>
|
438
|
|
439
|
<html>
|
440
|
<head>
|
441
|
<xsl:call-template name="system.head.content">
|
442
|
<xsl:with-param name="node" select="$doc"/>
|
443
|
</xsl:call-template>
|
444
|
<xsl:call-template name="head.content">
|
445
|
<xsl:with-param name="node" select="$doc"/>
|
446
|
</xsl:call-template>
|
447
|
<xsl:call-template name="user.head.content">
|
448
|
<xsl:with-param name="node" select="$doc"/>
|
449
|
</xsl:call-template>
|
450
|
</head>
|
451
|
<body>
|
452
|
<xsl:call-template name="body.attributes"/>
|
453
|
<xsl:call-template name="user.header.content">
|
454
|
<xsl:with-param name="node" select="$doc"/>
|
455
|
</xsl:call-template>
|
456
|
<xsl:apply-templates select="."/>
|
457
|
<xsl:call-template name="user.footer.content">
|
458
|
<xsl:with-param name="node" select="$doc"/>
|
459
|
</xsl:call-template>
|
460
|
</body>
|
461
|
</html>
|
462
|
<xsl:value-of select="$html.append"/>
|
463
|
</xsl:template>
|
464
|
|
465
|
<xsl:template name="root.messages">
|
466
|
<!-- redefine this any way you'd like to output messages -->
|
467
|
<!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
|
468
|
</xsl:template>
|
469
|
|
470
|
<!-- ==================================================================== -->
|
471
|
|
472
|
<xsl:template name="chunk">
|
473
|
<xsl:param name="node" select="."/>
|
474
|
|
475
|
<!-- The default is that we are not chunking... -->
|
476
|
<xsl:text>0</xsl:text>
|
477
|
</xsl:template>
|
478
|
|
479
|
<!-- ==================================================================== -->
|
480
|
|
481
|
</xsl:stylesheet>
|