docbook_xsl_wrapper 0.1.2 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/CHANGELOG +41 -0
- data/README.md +9 -17
- data/bin/docbook_xsl_wrapper +9 -14
- data/docbook_xsl_wrapper.gemspec +8 -7
- data/lib/docbook_xsl_wrapper.rb +24 -1
- data/lib/docbook_xsl_wrapper/epub.rb +124 -122
- data/lib/docbook_xsl_wrapper/options.rb +1 -1
- data/lib/docbook_xsl_wrapper/validate.rb +22 -0
- data/lib/docbook_xsl_wrapper/version.rb +1 -1
- data/schema/docbookxi.rng +18654 -0
- data/spec/docbook_xsl_wrapper/validate_spec.rb +64 -0
- data/xsl/AUTHORS +4 -0
- data/xsl/COPYING +48 -0
- data/xsl/REVISION +1 -0
- data/xsl/VERSION.xsl +115 -0
- data/xsl/common/addns.xsl +124 -0
- data/xsl/common/af.xml +1272 -0
- data/xsl/common/am.xml +1272 -0
- data/xsl/common/ar.xml +1272 -0
- data/xsl/common/as.xml +703 -0
- data/xsl/common/ast.xml +703 -0
- data/xsl/common/autoidx-kimber.xsl +45 -0
- data/xsl/common/autoidx-kosek.xsl +155 -0
- data/xsl/common/az.xml +715 -0
- data/xsl/common/bg.xml +767 -0
- data/xsl/common/bn.xml +1272 -0
- data/xsl/common/bn_in.xml +703 -0
- data/xsl/common/bs.xml +705 -0
- data/xsl/common/ca.xml +703 -0
- data/xsl/common/charmap.xsl +222 -0
- data/xsl/common/common.xsl +2129 -0
- data/xsl/common/cs.xml +743 -0
- data/xsl/common/cy.xml +1288 -0
- data/xsl/common/da.xml +707 -0
- data/xsl/common/de.xml +709 -0
- data/xsl/common/el.xml +772 -0
- data/xsl/common/en.xml +1272 -0
- data/xsl/common/entities.ent +67 -0
- data/xsl/common/eo.xml +1272 -0
- data/xsl/common/es.xml +719 -0
- data/xsl/common/et.xml +1272 -0
- data/xsl/common/eu.xml +1272 -0
- data/xsl/common/fa.xml +703 -0
- data/xsl/common/fi.xml +713 -0
- data/xsl/common/fr.xml +733 -0
- data/xsl/common/ga.xml +1272 -0
- data/xsl/common/gentext.xsl +855 -0
- data/xsl/common/gl.xml +1272 -0
- data/xsl/common/gu.xml +703 -0
- data/xsl/common/he.xml +1272 -0
- data/xsl/common/hi.xml +703 -0
- data/xsl/common/hr.xml +705 -0
- data/xsl/common/hu.xml +721 -0
- data/xsl/common/id.xml +1272 -0
- data/xsl/common/insertfile.xsl +113 -0
- data/xsl/common/is.xml +715 -0
- data/xsl/common/it.xml +1272 -0
- data/xsl/common/ja.xml +703 -0
- data/xsl/common/ka.xml +743 -0
- data/xsl/common/kn.xml +1272 -0
- data/xsl/common/ko.xml +1272 -0
- data/xsl/common/ky.xml +775 -0
- data/xsl/common/l10n.dtd +64 -0
- data/xsl/common/l10n.xml +78 -0
- data/xsl/common/l10n.xsl +598 -0
- data/xsl/common/la.xml +1272 -0
- data/xsl/common/labels.xsl +933 -0
- data/xsl/common/lt.xml +721 -0
- data/xsl/common/lv.xml +1272 -0
- data/xsl/common/ml.xml +703 -0
- data/xsl/common/mn.xml +773 -0
- data/xsl/common/mr.xml +703 -0
- data/xsl/common/nb.xml +1272 -0
- data/xsl/common/nds.xml +709 -0
- data/xsl/common/nl.xml +703 -0
- data/xsl/common/nn.xml +1272 -0
- data/xsl/common/olink.xsl +1284 -0
- data/xsl/common/or.xml +1272 -0
- data/xsl/common/pa.xml +703 -0
- data/xsl/common/pi.xml +168 -0
- data/xsl/common/pi.xsl +347 -0
- data/xsl/common/pl.xml +721 -0
- data/xsl/common/pt.xml +1272 -0
- data/xsl/common/pt_br.xml +1272 -0
- data/xsl/common/refentry.xsl +1353 -0
- data/xsl/common/ro.xml +1272 -0
- data/xsl/common/ru.xml +769 -0
- data/xsl/common/sk.xml +1272 -0
- data/xsl/common/sl.xml +1272 -0
- data/xsl/common/sq.xml +1272 -0
- data/xsl/common/sr.xml +763 -0
- data/xsl/common/sr_Latn.xml +722 -0
- data/xsl/common/subtitles.xsl +181 -0
- data/xsl/common/sv.xml +707 -0
- data/xsl/common/ta.xml +703 -0
- data/xsl/common/table.xsl +515 -0
- data/xsl/common/targetdatabase.dtd +49 -0
- data/xsl/common/targets.xsl +338 -0
- data/xsl/common/te.xml +703 -0
- data/xsl/common/th.xml +1272 -0
- data/xsl/common/titles.xsl +850 -0
- data/xsl/common/tl.xml +1272 -0
- data/xsl/common/tr.xml +709 -0
- data/xsl/common/uk.xml +769 -0
- data/xsl/common/ur.xml +705 -0
- data/xsl/common/utility.xsl +291 -0
- data/xsl/common/vi.xml +1272 -0
- data/xsl/common/xh.xml +1272 -0
- data/xsl/common/zh.xml +703 -0
- data/xsl/common/zh_cn.xml +703 -0
- data/xsl/common/zh_tw.xml +703 -0
- data/xsl/epub/docbook.xsl +1769 -0
- data/xsl/epub3/chunk.xsl +30 -0
- data/xsl/epub3/docbook-epub.css.xml +142 -0
- data/xsl/epub3/docbook.xsl +20 -0
- data/xsl/epub3/epub3-chunk-mods.xsl +52 -0
- data/xsl/epub3/epub3-element-mods.xsl +2533 -0
- data/xsl/epub3/titlepage.templates.xml +712 -0
- data/xsl/epub3/titlepage.templates.xsl +3842 -0
- data/xsl/lib/lib.xsl +533 -0
- data/xsl/xhtml/admon.xsl +142 -0
- data/xsl/xhtml/annotations.xsl +160 -0
- data/xsl/xhtml/autoidx.xsl +831 -0
- data/xsl/xhtml/autotoc.xsl +706 -0
- data/xsl/xhtml/biblio-iso690.xsl +1302 -0
- data/xsl/xhtml/biblio.xsl +1371 -0
- data/xsl/xhtml/block.xsl +584 -0
- data/xsl/xhtml/callout.xsl +210 -0
- data/xsl/xhtml/chunk-code.xsl +675 -0
- data/xsl/xhtml/chunk-common.xsl +1627 -0
- data/xsl/xhtml/chunker.xsl +317 -0
- data/xsl/xhtml/component.xsl +440 -0
- data/xsl/xhtml/division.xsl +214 -0
- data/xsl/xhtml/ebnf.xsl +331 -0
- data/xsl/xhtml/footnote.xsl +346 -0
- data/xsl/xhtml/formal.xsl +496 -0
- data/xsl/xhtml/glossary.xsl +602 -0
- data/xsl/xhtml/graphics.xsl +1537 -0
- data/xsl/xhtml/html-rtf.xsl +321 -0
- data/xsl/xhtml/html.xsl +690 -0
- data/xsl/xhtml/htmltbl.xsl +102 -0
- data/xsl/xhtml/index.xsl +264 -0
- data/xsl/xhtml/info.xsl +48 -0
- data/xsl/xhtml/inline.xsl +1508 -0
- data/xsl/xhtml/its.xsl +109 -0
- data/xsl/xhtml/keywords.xsl +38 -0
- data/xsl/xhtml/lists.xsl +1227 -0
- data/xsl/xhtml/math.xsl +286 -0
- data/xsl/xhtml/param.xsl +449 -0
- data/xsl/xhtml/pi.xsl +1237 -0
- data/xsl/xhtml/qandaset.xsl +440 -0
- data/xsl/xhtml/refentry.xsl +307 -0
- data/xsl/xhtml/sections.xsl +564 -0
- data/xsl/xhtml/synop.xsl +1623 -0
- data/xsl/xhtml/table.xsl +1179 -0
- data/xsl/xhtml/task.xsl +76 -0
- data/xsl/xhtml/titlepage.templates.xsl +4005 -0
- data/xsl/xhtml/titlepage.xsl +1108 -0
- data/xsl/xhtml/toc.xsl +334 -0
- data/xsl/xhtml/verbatim.xsl +389 -0
- data/xsl/xhtml/xref.xsl +1268 -0
- data/xsl/xhtml5/docbook.xsl +22 -0
- data/xsl/xhtml5/html5-chunk-mods.xsl +112 -0
- data/xsl/xhtml5/html5-element-mods.xsl +791 -0
- data/xsl/xhtml5/xhtml-docbook.xsl +531 -0
- metadata +207 -27
- data/.rvmrc +0 -48
- data/xslt/obfuscate.xsl +0 -12
|
@@ -0,0 +1,321 @@
|
|
|
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:exsl="http://exslt.org/common" xmlns:set="http://exslt.org/sets" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="exsl set" version="1.0">
|
|
5
|
+
|
|
6
|
+
<!-- ********************************************************************
|
|
7
|
+
$Id: html-rtf.xsl 8345 2009-03-16 06:44:07Z 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
|
+
<!-- This module contains templates that match against HTML nodes. It is used
|
|
19
|
+
to post-process result tree fragments for some sorts of cleanup.
|
|
20
|
+
These templates can only ever be fired by a processor that supports
|
|
21
|
+
exslt:node-set(). -->
|
|
22
|
+
|
|
23
|
+
<!-- ==================================================================== -->
|
|
24
|
+
|
|
25
|
+
<!-- insert.html.p mode templates insert a particular RTF at the beginning
|
|
26
|
+
of the first paragraph in the primary RTF. -->
|
|
27
|
+
|
|
28
|
+
<xsl:template match="/" mode="insert.html.p">
|
|
29
|
+
<xsl:param name="mark" select="'?'"/>
|
|
30
|
+
<xsl:apply-templates mode="insert.html.p">
|
|
31
|
+
<xsl:with-param name="mark" select="$mark"/>
|
|
32
|
+
</xsl:apply-templates>
|
|
33
|
+
</xsl:template>
|
|
34
|
+
|
|
35
|
+
<xsl:template match="*" mode="insert.html.p">
|
|
36
|
+
<xsl:param name="mark" select="'?'"/>
|
|
37
|
+
<xsl:copy>
|
|
38
|
+
<xsl:copy-of select="@*"/>
|
|
39
|
+
<xsl:apply-templates mode="insert.html.p">
|
|
40
|
+
<xsl:with-param name="mark" select="$mark"/>
|
|
41
|
+
</xsl:apply-templates>
|
|
42
|
+
</xsl:copy>
|
|
43
|
+
</xsl:template>
|
|
44
|
+
|
|
45
|
+
<xsl:template xmlns:html="http://www.w3.org/1999/xhtml" match="html:p|p" mode="insert.html.p">
|
|
46
|
+
<xsl:param name="mark" select="'?'"/>
|
|
47
|
+
<xsl:copy>
|
|
48
|
+
<xsl:copy-of select="@*"/>
|
|
49
|
+
<xsl:if test="not(preceding::p|preceding::html:p)">
|
|
50
|
+
<xsl:copy-of select="$mark"/>
|
|
51
|
+
</xsl:if>
|
|
52
|
+
<xsl:apply-templates mode="insert.html.p">
|
|
53
|
+
<xsl:with-param name="mark" select="$mark"/>
|
|
54
|
+
</xsl:apply-templates>
|
|
55
|
+
</xsl:copy>
|
|
56
|
+
</xsl:template>
|
|
57
|
+
|
|
58
|
+
<xsl:template match="text()|processing-instruction()|comment()" mode="insert.html.p">
|
|
59
|
+
<xsl:param name="mark" select="'?'"/>
|
|
60
|
+
<xsl:copy/>
|
|
61
|
+
</xsl:template>
|
|
62
|
+
|
|
63
|
+
<!-- ==================================================================== -->
|
|
64
|
+
|
|
65
|
+
<!-- insert.html.text mode templates insert a particular RTF at the beginning
|
|
66
|
+
of the first text-node in the primary RTF. -->
|
|
67
|
+
|
|
68
|
+
<xsl:template match="/" mode="insert.html.text">
|
|
69
|
+
<xsl:param name="mark" select="'?'"/>
|
|
70
|
+
<xsl:apply-templates mode="insert.html.text">
|
|
71
|
+
<xsl:with-param name="mark" select="$mark"/>
|
|
72
|
+
</xsl:apply-templates>
|
|
73
|
+
</xsl:template>
|
|
74
|
+
|
|
75
|
+
<xsl:template match="*" mode="insert.html.text">
|
|
76
|
+
<xsl:param name="mark" select="'?'"/>
|
|
77
|
+
<xsl:copy>
|
|
78
|
+
<xsl:copy-of select="@*"/>
|
|
79
|
+
<xsl:apply-templates mode="insert.html.text">
|
|
80
|
+
<xsl:with-param name="mark" select="$mark"/>
|
|
81
|
+
</xsl:apply-templates>
|
|
82
|
+
</xsl:copy>
|
|
83
|
+
</xsl:template>
|
|
84
|
+
|
|
85
|
+
<xsl:template match="text()|processing-instruction()|comment()" mode="insert.html.text">
|
|
86
|
+
<xsl:param name="mark" select="'?'"/>
|
|
87
|
+
|
|
88
|
+
<xsl:if test="not(preceding::text())">
|
|
89
|
+
<xsl:copy-of select="$mark"/>
|
|
90
|
+
</xsl:if>
|
|
91
|
+
|
|
92
|
+
<xsl:copy/>
|
|
93
|
+
</xsl:template>
|
|
94
|
+
|
|
95
|
+
<xsl:template match="processing-instruction()|comment()" mode="insert.html.text">
|
|
96
|
+
<xsl:param name="mark" select="'?'"/>
|
|
97
|
+
<xsl:copy/>
|
|
98
|
+
</xsl:template>
|
|
99
|
+
|
|
100
|
+
<!-- ==================================================================== -->
|
|
101
|
+
|
|
102
|
+
<!-- unwrap.p mode templates remove blocks from HTML p elements (and
|
|
103
|
+
other places where blocks aren't allowed) -->
|
|
104
|
+
|
|
105
|
+
<xsl:template name="unwrap.p">
|
|
106
|
+
<xsl:param name="p"/>
|
|
107
|
+
<xsl:choose>
|
|
108
|
+
<xsl:when test="$exsl.node.set.available != 0 and function-available('set:leading') and function-available('set:trailing')">
|
|
109
|
+
<xsl:apply-templates select="exsl:node-set($p)" mode="unwrap.p"/>
|
|
110
|
+
</xsl:when>
|
|
111
|
+
<xsl:otherwise>
|
|
112
|
+
<xsl:copy-of select="$p"/>
|
|
113
|
+
</xsl:otherwise>
|
|
114
|
+
</xsl:choose>
|
|
115
|
+
</xsl:template>
|
|
116
|
+
|
|
117
|
+
<xsl:template xmlns:html="http://www.w3.org/1999/xhtml" match="html:p|p" mode="unwrap.p">
|
|
118
|
+
<!-- xmlns:html is necessary for the xhtml stylesheet case -->
|
|
119
|
+
<xsl:variable name="blocks" select="address|blockquote|div|hr|h1|h2|h3|h4|h5|h6 |layer|p|pre|table|dl|menu|ol|ul|form |html:address|html:blockquote|html:div|html:hr |html:h1|html:h2|html:h3|html:h4|html:h5|html:h6 |html:layer|html:p|html:pre|html:table|html:dl |html:menu|html:ol|html:ul|html:form"/>
|
|
120
|
+
<xsl:choose>
|
|
121
|
+
<xsl:when test="$blocks">
|
|
122
|
+
<xsl:call-template name="unwrap.p.nodes">
|
|
123
|
+
<xsl:with-param name="wrap" select="."/>
|
|
124
|
+
<xsl:with-param name="first" select="1"/>
|
|
125
|
+
<xsl:with-param name="nodes" select="node()"/>
|
|
126
|
+
<xsl:with-param name="blocks" select="$blocks"/>
|
|
127
|
+
</xsl:call-template>
|
|
128
|
+
</xsl:when>
|
|
129
|
+
<xsl:otherwise>
|
|
130
|
+
<xsl:copy>
|
|
131
|
+
<xsl:copy-of select="@*"/>
|
|
132
|
+
<xsl:apply-templates mode="unwrap.p"/>
|
|
133
|
+
</xsl:copy>
|
|
134
|
+
</xsl:otherwise>
|
|
135
|
+
</xsl:choose>
|
|
136
|
+
</xsl:template>
|
|
137
|
+
|
|
138
|
+
<xsl:template match="*" mode="unwrap.p">
|
|
139
|
+
<xsl:copy>
|
|
140
|
+
<xsl:copy-of select="@*"/>
|
|
141
|
+
<xsl:apply-templates mode="unwrap.p"/>
|
|
142
|
+
</xsl:copy>
|
|
143
|
+
</xsl:template>
|
|
144
|
+
|
|
145
|
+
<xsl:template match="text()|processing-instruction()|comment()" mode="unwrap.p">
|
|
146
|
+
<xsl:copy/>
|
|
147
|
+
</xsl:template>
|
|
148
|
+
|
|
149
|
+
<xsl:template name="unwrap.p.nodes">
|
|
150
|
+
<xsl:param name="wrap" select="."/>
|
|
151
|
+
<xsl:param name="first" select="0"/>
|
|
152
|
+
<xsl:param name="nodes"/>
|
|
153
|
+
<xsl:param name="blocks"/>
|
|
154
|
+
<xsl:variable name="block" select="$blocks[1]"/>
|
|
155
|
+
|
|
156
|
+
<!-- This template should never get called if these functions aren't available -->
|
|
157
|
+
<!-- but this test is still necessary so that processors don't choke on the -->
|
|
158
|
+
<!-- function calls if they don't support the set: functions -->
|
|
159
|
+
<xsl:if test="function-available('set:leading') and function-available('set:trailing')">
|
|
160
|
+
<xsl:choose>
|
|
161
|
+
<xsl:when test="$blocks">
|
|
162
|
+
<xsl:variable name="leading" select="set:leading($nodes,$block)"/>
|
|
163
|
+
<xsl:variable name="trailing" select="set:trailing($nodes,$block)"/>
|
|
164
|
+
|
|
165
|
+
<xsl:if test="(($wrap/@id or $wrap/@xml:id) and $first = 1) or $leading">
|
|
166
|
+
<xsl:element name="{local-name($wrap)}" namespace="http://www.w3.org/1999/xhtml">
|
|
167
|
+
<xsl:for-each select="$wrap/@*">
|
|
168
|
+
<xsl:if test="$first != 0 or local-name(.) != 'id'">
|
|
169
|
+
<xsl:copy/>
|
|
170
|
+
</xsl:if>
|
|
171
|
+
</xsl:for-each>
|
|
172
|
+
<xsl:apply-templates select="$leading" mode="unwrap.p"/>
|
|
173
|
+
</xsl:element>
|
|
174
|
+
</xsl:if>
|
|
175
|
+
|
|
176
|
+
<xsl:apply-templates select="$block" mode="unwrap.p"/>
|
|
177
|
+
|
|
178
|
+
<xsl:if test="$trailing">
|
|
179
|
+
<xsl:call-template name="unwrap.p.nodes">
|
|
180
|
+
<xsl:with-param name="wrap" select="$wrap"/>
|
|
181
|
+
<xsl:with-param name="nodes" select="$trailing"/>
|
|
182
|
+
<xsl:with-param name="blocks" select="$blocks[position() > 1]"/>
|
|
183
|
+
</xsl:call-template>
|
|
184
|
+
</xsl:if>
|
|
185
|
+
</xsl:when>
|
|
186
|
+
|
|
187
|
+
<xsl:otherwise>
|
|
188
|
+
<xsl:if test="(($wrap/@id or $wrap/@xml:id) and $first = 1) or $nodes">
|
|
189
|
+
<xsl:element name="{local-name($wrap)}" namespace="http://www.w3.org/1999/xhtml">
|
|
190
|
+
<xsl:for-each select="$wrap/@*">
|
|
191
|
+
<xsl:if test="$first != 0 or local-name(.) != 'id'">
|
|
192
|
+
<xsl:copy/>
|
|
193
|
+
</xsl:if>
|
|
194
|
+
</xsl:for-each>
|
|
195
|
+
<xsl:apply-templates select="$nodes" mode="unwrap.p"/>
|
|
196
|
+
</xsl:element>
|
|
197
|
+
</xsl:if>
|
|
198
|
+
</xsl:otherwise>
|
|
199
|
+
</xsl:choose>
|
|
200
|
+
</xsl:if>
|
|
201
|
+
</xsl:template>
|
|
202
|
+
|
|
203
|
+
<!-- ==================================================================== -->
|
|
204
|
+
<!-- make.verbatim.mode replaces spaces and newlines -->
|
|
205
|
+
|
|
206
|
+
<xsl:template match="/" mode="make.verbatim.mode">
|
|
207
|
+
<xsl:apply-templates mode="make.verbatim.mode"/>
|
|
208
|
+
</xsl:template>
|
|
209
|
+
|
|
210
|
+
<xsl:template match="*" mode="make.verbatim.mode">
|
|
211
|
+
<xsl:copy>
|
|
212
|
+
<xsl:copy-of select="@*"/>
|
|
213
|
+
<xsl:apply-templates mode="make.verbatim.mode"/>
|
|
214
|
+
</xsl:copy>
|
|
215
|
+
</xsl:template>
|
|
216
|
+
|
|
217
|
+
<xsl:template match="processing-instruction()|comment()" mode="make.verbatim.mode">
|
|
218
|
+
<xsl:copy/>
|
|
219
|
+
</xsl:template>
|
|
220
|
+
|
|
221
|
+
<xsl:template match="text()" mode="make.verbatim.mode">
|
|
222
|
+
<xsl:variable name="text" select="translate(., ' ', ' ')"/>
|
|
223
|
+
|
|
224
|
+
<xsl:choose>
|
|
225
|
+
<xsl:when test="not(contains($text, ' '))">
|
|
226
|
+
<xsl:value-of select="$text"/>
|
|
227
|
+
</xsl:when>
|
|
228
|
+
|
|
229
|
+
<xsl:otherwise>
|
|
230
|
+
<xsl:variable name="len" select="string-length($text)"/>
|
|
231
|
+
|
|
232
|
+
<xsl:choose>
|
|
233
|
+
<xsl:when test="$len = 1">
|
|
234
|
+
<br/><xsl:text>
|
|
235
|
+
</xsl:text>
|
|
236
|
+
</xsl:when>
|
|
237
|
+
|
|
238
|
+
<xsl:otherwise>
|
|
239
|
+
<xsl:variable name="half" select="$len div 2"/>
|
|
240
|
+
<xsl:call-template name="make-verbatim-recursive">
|
|
241
|
+
<xsl:with-param name="text" select="substring($text, 1, $half)"/>
|
|
242
|
+
</xsl:call-template>
|
|
243
|
+
<xsl:call-template name="make-verbatim-recursive">
|
|
244
|
+
<xsl:with-param name="text" select="substring($text, ($half + 1), $len)"/>
|
|
245
|
+
</xsl:call-template>
|
|
246
|
+
</xsl:otherwise>
|
|
247
|
+
</xsl:choose>
|
|
248
|
+
</xsl:otherwise>
|
|
249
|
+
</xsl:choose>
|
|
250
|
+
</xsl:template>
|
|
251
|
+
|
|
252
|
+
<xsl:template name="make-verbatim-recursive">
|
|
253
|
+
<xsl:param name="text" select="''"/>
|
|
254
|
+
|
|
255
|
+
<xsl:choose>
|
|
256
|
+
<xsl:when test="not(contains($text, ' '))">
|
|
257
|
+
<xsl:value-of select="$text"/>
|
|
258
|
+
</xsl:when>
|
|
259
|
+
|
|
260
|
+
<xsl:otherwise>
|
|
261
|
+
<xsl:variable name="len" select="string-length($text)"/>
|
|
262
|
+
|
|
263
|
+
<xsl:choose>
|
|
264
|
+
<xsl:when test="$len = 1">
|
|
265
|
+
<br/><xsl:text>
|
|
266
|
+
</xsl:text>
|
|
267
|
+
</xsl:when>
|
|
268
|
+
|
|
269
|
+
<xsl:otherwise>
|
|
270
|
+
<xsl:variable name="half" select="$len div 2"/>
|
|
271
|
+
<xsl:call-template name="make-verbatim-recursive">
|
|
272
|
+
<xsl:with-param name="text" select="substring($text, 1, $half)"/>
|
|
273
|
+
</xsl:call-template>
|
|
274
|
+
<xsl:call-template name="make-verbatim-recursive">
|
|
275
|
+
<xsl:with-param name="text" select="substring($text, ($half + 1), $len)"/>
|
|
276
|
+
</xsl:call-template>
|
|
277
|
+
</xsl:otherwise>
|
|
278
|
+
</xsl:choose>
|
|
279
|
+
</xsl:otherwise>
|
|
280
|
+
</xsl:choose>
|
|
281
|
+
</xsl:template>
|
|
282
|
+
|
|
283
|
+
<!-- ==================================================================== -->
|
|
284
|
+
|
|
285
|
+
<!-- remove.empty.div mode templates remove empty blocks -->
|
|
286
|
+
|
|
287
|
+
<xsl:template name="remove.empty.div">
|
|
288
|
+
<xsl:param name="div"/>
|
|
289
|
+
<xsl:choose>
|
|
290
|
+
<xsl:when test="$exsl.node.set.available != 0">
|
|
291
|
+
<xsl:apply-templates select="exsl:node-set($div)" mode="remove.empty.div"/>
|
|
292
|
+
</xsl:when>
|
|
293
|
+
<xsl:otherwise>
|
|
294
|
+
<xsl:copy-of select="$div"/>
|
|
295
|
+
</xsl:otherwise>
|
|
296
|
+
</xsl:choose>
|
|
297
|
+
</xsl:template>
|
|
298
|
+
|
|
299
|
+
<xsl:template xmlns:html="http://www.w3.org/1999/xhtml" match="html:p|p|html:div|div" mode="remove.empty.div">
|
|
300
|
+
<xsl:if test="node()">
|
|
301
|
+
<xsl:copy>
|
|
302
|
+
<xsl:copy-of select="@*"/>
|
|
303
|
+
<xsl:apply-templates mode="remove.empty.div"/>
|
|
304
|
+
</xsl:copy>
|
|
305
|
+
</xsl:if>
|
|
306
|
+
</xsl:template>
|
|
307
|
+
|
|
308
|
+
<xsl:template match="*" mode="remove.empty.div">
|
|
309
|
+
<xsl:copy>
|
|
310
|
+
<xsl:copy-of select="@*"/>
|
|
311
|
+
<xsl:apply-templates mode="remove.empty.div"/>
|
|
312
|
+
</xsl:copy>
|
|
313
|
+
</xsl:template>
|
|
314
|
+
|
|
315
|
+
<xsl:template match="text()|processing-instruction()|comment()" mode="remove.empty.div">
|
|
316
|
+
<xsl:copy/>
|
|
317
|
+
</xsl:template>
|
|
318
|
+
|
|
319
|
+
<!-- ==================================================================== -->
|
|
320
|
+
|
|
321
|
+
</xsl:stylesheet>
|
data/xsl/xhtml/html.xsl
ADDED
|
@@ -0,0 +1,690 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="ASCII"?>
|
|
2
|
+
<!--This file was created automatically by html2xhtml-->
|
|
3
|
+
<!--from the HTML stylesheets.-->
|
|
4
|
+
<xsl:stylesheet exclude-result-prefixes="d"
|
|
5
|
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook"
|
|
6
|
+
xmlns="http://www.w3.org/1999/xhtml" version="1.0">
|
|
7
|
+
|
|
8
|
+
<!-- ********************************************************************
|
|
9
|
+
$Id: html.xsl 9772 2013-05-15 08:05:56Z kosek $
|
|
10
|
+
********************************************************************
|
|
11
|
+
|
|
12
|
+
This file is part of the XSL DocBook Stylesheet distribution.
|
|
13
|
+
See ../README or http://docbook.sf.net/release/xsl/current/ for
|
|
14
|
+
copyright and other information.
|
|
15
|
+
|
|
16
|
+
******************************************************************** -->
|
|
17
|
+
|
|
18
|
+
<!-- These variables set the align attribute value for HTML output based on
|
|
19
|
+
the writing-mode specified in the gentext file for the document's lang. -->
|
|
20
|
+
|
|
21
|
+
<xsl:variable name="direction.align.start">
|
|
22
|
+
<xsl:choose>
|
|
23
|
+
<xsl:when test="starts-with($writing.mode, 'lr')">left</xsl:when>
|
|
24
|
+
<xsl:when test="starts-with($writing.mode, 'rl')">right</xsl:when>
|
|
25
|
+
<xsl:otherwise>left</xsl:otherwise>
|
|
26
|
+
</xsl:choose>
|
|
27
|
+
</xsl:variable>
|
|
28
|
+
|
|
29
|
+
<xsl:variable name="direction.align.end">
|
|
30
|
+
<xsl:choose>
|
|
31
|
+
<xsl:when test="starts-with($writing.mode, 'lr')">right</xsl:when>
|
|
32
|
+
<xsl:when test="starts-with($writing.mode, 'rl')">left</xsl:when>
|
|
33
|
+
<xsl:otherwise>right</xsl:otherwise>
|
|
34
|
+
</xsl:choose>
|
|
35
|
+
</xsl:variable>
|
|
36
|
+
|
|
37
|
+
<xsl:variable name="direction.mode">
|
|
38
|
+
<xsl:choose>
|
|
39
|
+
<xsl:when test="starts-with($writing.mode, 'lr')">ltr</xsl:when>
|
|
40
|
+
<xsl:when test="starts-with($writing.mode, 'rl')">rtl</xsl:when>
|
|
41
|
+
<xsl:otherwise>ltr</xsl:otherwise>
|
|
42
|
+
</xsl:choose>
|
|
43
|
+
</xsl:variable>
|
|
44
|
+
|
|
45
|
+
<!-- Support switching to <section> for HTML5 stylesheet -->
|
|
46
|
+
<!-- This is an internal variable that does not need to be set by a user -->
|
|
47
|
+
<xsl:variable name="div.element">div</xsl:variable>
|
|
48
|
+
<!-- Support turning off table border with border="" for HTML5 -->
|
|
49
|
+
<xsl:variable name="table.border.off">0</xsl:variable>
|
|
50
|
+
|
|
51
|
+
<!-- The generate.html.title template is currently used for generating HTML -->
|
|
52
|
+
<!-- "title" attributes for some inline elements only, but not for any -->
|
|
53
|
+
<!-- block elements. It is called in eleven places in the inline.xsl -->
|
|
54
|
+
<!-- file. But it's called by all the inline.* templates (e.g., -->
|
|
55
|
+
<!-- inline.boldseq), which in turn are called by other (element) -->
|
|
56
|
+
<!-- templates, so it results, currently, in supporting generation of the -->
|
|
57
|
+
<!-- HTML "title" attribute for a total of about 92 elements. -->
|
|
58
|
+
<!-- You can use mode="html.title.attribute" to get a title for -->
|
|
59
|
+
<!-- an element specified by a param, including targets of cross references. -->
|
|
60
|
+
<xsl:template name="generate.html.title">
|
|
61
|
+
<xsl:apply-templates select="." mode="html.title.attribute"/>
|
|
62
|
+
</xsl:template>
|
|
63
|
+
|
|
64
|
+
<xsl:template match="d:acronym|d:abbrev" mode="html.title.attribute">
|
|
65
|
+
<xsl:if test="d:alt">
|
|
66
|
+
<xsl:attribute name="title">
|
|
67
|
+
<xsl:value-of select="normalize-space(d:alt)"/>
|
|
68
|
+
</xsl:attribute>
|
|
69
|
+
</xsl:if>
|
|
70
|
+
</xsl:template>
|
|
71
|
+
|
|
72
|
+
<!-- Generate a title attribute for the context node -->
|
|
73
|
+
<!-- This may be the target of an xref -->
|
|
74
|
+
<xsl:template match="*" mode="html.title.attribute">
|
|
75
|
+
<xsl:variable name="is.title">
|
|
76
|
+
<xsl:call-template name="gentext.template.exists">
|
|
77
|
+
<xsl:with-param name="context" select="'title'"/>
|
|
78
|
+
<xsl:with-param name="name" select="local-name(.)"/>
|
|
79
|
+
<xsl:with-param name="lang">
|
|
80
|
+
<xsl:call-template name="l10n.language"/>
|
|
81
|
+
</xsl:with-param>
|
|
82
|
+
</xsl:call-template>
|
|
83
|
+
</xsl:variable>
|
|
84
|
+
|
|
85
|
+
<xsl:variable name="is.title-numbered">
|
|
86
|
+
<xsl:call-template name="gentext.template.exists">
|
|
87
|
+
<xsl:with-param name="context" select="'title-numbered'"/>
|
|
88
|
+
<xsl:with-param name="name" select="local-name(.)"/>
|
|
89
|
+
<xsl:with-param name="lang">
|
|
90
|
+
<xsl:call-template name="l10n.language"/>
|
|
91
|
+
</xsl:with-param>
|
|
92
|
+
</xsl:call-template>
|
|
93
|
+
</xsl:variable>
|
|
94
|
+
|
|
95
|
+
<xsl:variable name="is.title-unnumbered">
|
|
96
|
+
<xsl:call-template name="gentext.template.exists">
|
|
97
|
+
<xsl:with-param name="context" select="'title-unnumbered'"/>
|
|
98
|
+
<xsl:with-param name="name" select="local-name(.)"/>
|
|
99
|
+
<xsl:with-param name="lang">
|
|
100
|
+
<xsl:call-template name="l10n.language"/>
|
|
101
|
+
</xsl:with-param>
|
|
102
|
+
</xsl:call-template>
|
|
103
|
+
</xsl:variable>
|
|
104
|
+
|
|
105
|
+
<xsl:variable name="has.title.markup">
|
|
106
|
+
<xsl:apply-templates select="." mode="title.markup">
|
|
107
|
+
<xsl:with-param name="verbose" select="0"/>
|
|
108
|
+
</xsl:apply-templates>
|
|
109
|
+
</xsl:variable>
|
|
110
|
+
|
|
111
|
+
<xsl:variable name="gentext.title">
|
|
112
|
+
<xsl:if test="$has.title.markup != '???TITLE???' and ($is.title != 0 or $is.title-numbered != 0 or $is.title-unnumbered != 0)">
|
|
113
|
+
<xsl:apply-templates select="." mode="object.title.markup.textonly"/>
|
|
114
|
+
</xsl:if>
|
|
115
|
+
</xsl:variable>
|
|
116
|
+
|
|
117
|
+
<xsl:choose>
|
|
118
|
+
<xsl:when test="string-length($gentext.title) != 0">
|
|
119
|
+
<xsl:attribute name="title">
|
|
120
|
+
<xsl:value-of select="$gentext.title"/>
|
|
121
|
+
</xsl:attribute>
|
|
122
|
+
</xsl:when>
|
|
123
|
+
<!-- Fall back to alt if available -->
|
|
124
|
+
<xsl:when test="d:alt">
|
|
125
|
+
<xsl:attribute name="title">
|
|
126
|
+
<xsl:value-of select="normalize-space(d:alt)"/>
|
|
127
|
+
</xsl:attribute>
|
|
128
|
+
</xsl:when>
|
|
129
|
+
</xsl:choose>
|
|
130
|
+
</xsl:template>
|
|
131
|
+
|
|
132
|
+
<xsl:template match="d:qandaentry" mode="html.title.attribute">
|
|
133
|
+
<xsl:apply-templates select="d:question" mode="html.title.attribute"/>
|
|
134
|
+
</xsl:template>
|
|
135
|
+
|
|
136
|
+
<xsl:template match="d:question" mode="html.title.attribute">
|
|
137
|
+
<xsl:variable name="label.text">
|
|
138
|
+
<xsl:apply-templates select="." mode="qanda.label"/>
|
|
139
|
+
</xsl:variable>
|
|
140
|
+
|
|
141
|
+
<xsl:choose>
|
|
142
|
+
<xsl:when test="string-length($label.text) != 0">
|
|
143
|
+
<xsl:attribute name="title">
|
|
144
|
+
<xsl:value-of select="$label.text"/>
|
|
145
|
+
</xsl:attribute>
|
|
146
|
+
</xsl:when>
|
|
147
|
+
<!-- Fall back to alt if available -->
|
|
148
|
+
<xsl:when test="d:alt">
|
|
149
|
+
<xsl:attribute name="title">
|
|
150
|
+
<xsl:value-of select="normalize-space(d:alt)"/>
|
|
151
|
+
</xsl:attribute>
|
|
152
|
+
</xsl:when>
|
|
153
|
+
</xsl:choose>
|
|
154
|
+
</xsl:template>
|
|
155
|
+
|
|
156
|
+
<xsl:template name="dir">
|
|
157
|
+
<xsl:param name="inherit" select="0"/>
|
|
158
|
+
|
|
159
|
+
<xsl:variable name="dir">
|
|
160
|
+
<xsl:choose>
|
|
161
|
+
<xsl:when test="@dir">
|
|
162
|
+
<xsl:value-of select="@dir"/>
|
|
163
|
+
</xsl:when>
|
|
164
|
+
<xsl:when test="$inherit != 0">
|
|
165
|
+
<xsl:value-of select="ancestor::*/@dir[1]"/>
|
|
166
|
+
</xsl:when>
|
|
167
|
+
</xsl:choose>
|
|
168
|
+
</xsl:variable>
|
|
169
|
+
|
|
170
|
+
<xsl:if test="$dir != ''">
|
|
171
|
+
<xsl:attribute name="dir">
|
|
172
|
+
<xsl:value-of select="$dir"/>
|
|
173
|
+
</xsl:attribute>
|
|
174
|
+
</xsl:if>
|
|
175
|
+
</xsl:template>
|
|
176
|
+
|
|
177
|
+
<xsl:template name="anchor">
|
|
178
|
+
<xsl:param name="node" select="."/>
|
|
179
|
+
<xsl:param name="conditional" select="1"/>
|
|
180
|
+
|
|
181
|
+
<xsl:choose>
|
|
182
|
+
<xsl:when test="$generate.id.attributes != 0">
|
|
183
|
+
<!-- No named anchors output when this param is set -->
|
|
184
|
+
</xsl:when>
|
|
185
|
+
<xsl:when test="$conditional = 0 or $node/@id or $node/@xml:id">
|
|
186
|
+
<a>
|
|
187
|
+
<xsl:attribute name="id">
|
|
188
|
+
<xsl:call-template name="object.id">
|
|
189
|
+
<xsl:with-param name="object" select="$node"/>
|
|
190
|
+
</xsl:call-template>
|
|
191
|
+
</xsl:attribute>
|
|
192
|
+
</a>
|
|
193
|
+
</xsl:when>
|
|
194
|
+
</xsl:choose>
|
|
195
|
+
</xsl:template>
|
|
196
|
+
|
|
197
|
+
<xsl:template name="id.attribute">
|
|
198
|
+
<xsl:param name="node" select="."/>
|
|
199
|
+
<xsl:param name="conditional" select="1"/>
|
|
200
|
+
<xsl:choose>
|
|
201
|
+
<xsl:when test="$generate.id.attributes = 0">
|
|
202
|
+
<!-- No id attributes when this param is zero -->
|
|
203
|
+
</xsl:when>
|
|
204
|
+
<xsl:when test="$conditional = 0 or $node/@id or $node/@xml:id">
|
|
205
|
+
<xsl:attribute name="id">
|
|
206
|
+
<xsl:call-template name="object.id">
|
|
207
|
+
<xsl:with-param name="object" select="$node"/>
|
|
208
|
+
</xsl:call-template>
|
|
209
|
+
</xsl:attribute>
|
|
210
|
+
</xsl:when>
|
|
211
|
+
</xsl:choose>
|
|
212
|
+
</xsl:template>
|
|
213
|
+
|
|
214
|
+
<xsl:template name="href.target.uri">
|
|
215
|
+
<xsl:param name="context" select="."/>
|
|
216
|
+
<xsl:param name="object" select="."/>
|
|
217
|
+
<xsl:text>#</xsl:text>
|
|
218
|
+
<xsl:call-template name="object.id">
|
|
219
|
+
<xsl:with-param name="object" select="$object"/>
|
|
220
|
+
</xsl:call-template>
|
|
221
|
+
</xsl:template>
|
|
222
|
+
|
|
223
|
+
<xsl:template name="href.target">
|
|
224
|
+
<xsl:param name="context" select="."/>
|
|
225
|
+
<xsl:param name="object" select="."/>
|
|
226
|
+
<xsl:text>#</xsl:text>
|
|
227
|
+
<xsl:call-template name="object.id">
|
|
228
|
+
<xsl:with-param name="object" select="$object"/>
|
|
229
|
+
</xsl:call-template>
|
|
230
|
+
</xsl:template>
|
|
231
|
+
|
|
232
|
+
<xsl:template name="href.target.with.base.dir">
|
|
233
|
+
<xsl:param name="context" select="."/>
|
|
234
|
+
<xsl:param name="object" select="."/>
|
|
235
|
+
<xsl:if test="$manifest.in.base.dir = 0">
|
|
236
|
+
<xsl:value-of select="$chunk.base.dir"/>
|
|
237
|
+
</xsl:if>
|
|
238
|
+
<xsl:call-template name="href.target">
|
|
239
|
+
<xsl:with-param name="context" select="$context"/>
|
|
240
|
+
<xsl:with-param name="object" select="$object"/>
|
|
241
|
+
</xsl:call-template>
|
|
242
|
+
</xsl:template>
|
|
243
|
+
|
|
244
|
+
<xsl:template name="dingbat">
|
|
245
|
+
<xsl:param name="dingbat">bullet</xsl:param>
|
|
246
|
+
<xsl:call-template name="dingbat.characters">
|
|
247
|
+
<xsl:with-param name="dingbat" select="$dingbat"/>
|
|
248
|
+
</xsl:call-template>
|
|
249
|
+
</xsl:template>
|
|
250
|
+
|
|
251
|
+
<xsl:template name="dingbat.characters">
|
|
252
|
+
<!-- now that I'm using the real serializer, all that dingbat malarky -->
|
|
253
|
+
<!-- isn't necessary anymore... -->
|
|
254
|
+
<xsl:param name="dingbat">bullet</xsl:param>
|
|
255
|
+
<xsl:choose>
|
|
256
|
+
<xsl:when test="$dingbat='bullet'">•</xsl:when>
|
|
257
|
+
<xsl:when test="$dingbat='copyright'">©</xsl:when>
|
|
258
|
+
<xsl:when test="$dingbat='trademark'">™</xsl:when>
|
|
259
|
+
<xsl:when test="$dingbat='trade'">™</xsl:when>
|
|
260
|
+
<xsl:when test="$dingbat='registered'">®</xsl:when>
|
|
261
|
+
<xsl:when test="$dingbat='service'">(SM)</xsl:when>
|
|
262
|
+
<xsl:when test="$dingbat='nbsp'"> </xsl:when>
|
|
263
|
+
<xsl:when test="$dingbat='ldquo'">“</xsl:when>
|
|
264
|
+
<xsl:when test="$dingbat='rdquo'">”</xsl:when>
|
|
265
|
+
<xsl:when test="$dingbat='lsquo'">‘</xsl:when>
|
|
266
|
+
<xsl:when test="$dingbat='rsquo'">’</xsl:when>
|
|
267
|
+
<xsl:when test="$dingbat='em-dash'">—</xsl:when>
|
|
268
|
+
<xsl:when test="$dingbat='mdash'">—</xsl:when>
|
|
269
|
+
<xsl:when test="$dingbat='en-dash'">–</xsl:when>
|
|
270
|
+
<xsl:when test="$dingbat='ndash'">–</xsl:when>
|
|
271
|
+
<xsl:otherwise>
|
|
272
|
+
<xsl:text>•</xsl:text>
|
|
273
|
+
</xsl:otherwise>
|
|
274
|
+
</xsl:choose>
|
|
275
|
+
</xsl:template>
|
|
276
|
+
|
|
277
|
+
<xsl:template name="id.warning">
|
|
278
|
+
<xsl:if test="$id.warnings != 0 and not(@id) and not(@xml:id) and parent::*">
|
|
279
|
+
<xsl:variable name="title">
|
|
280
|
+
<xsl:choose>
|
|
281
|
+
<xsl:when test="d:title">
|
|
282
|
+
<xsl:value-of select="d:title[1]"/>
|
|
283
|
+
</xsl:when>
|
|
284
|
+
<xsl:when test="substring(local-name(*[1]), string-length(local-name(*[1])-3) = 'info') and *[1]/d:title">
|
|
285
|
+
<xsl:value-of select="*[1]/d:title[1]"/>
|
|
286
|
+
</xsl:when>
|
|
287
|
+
<xsl:when test="d:refmeta/d:refentrytitle">
|
|
288
|
+
<xsl:value-of select="d:refmeta/d:refentrytitle"/>
|
|
289
|
+
</xsl:when>
|
|
290
|
+
<xsl:when test="d:refnamediv/d:refname">
|
|
291
|
+
<xsl:value-of select="d:refnamediv/d:refname[1]"/>
|
|
292
|
+
</xsl:when>
|
|
293
|
+
</xsl:choose>
|
|
294
|
+
</xsl:variable>
|
|
295
|
+
|
|
296
|
+
<xsl:message>
|
|
297
|
+
<xsl:text>ID recommended on </xsl:text>
|
|
298
|
+
<xsl:value-of select="local-name(.)"/>
|
|
299
|
+
<xsl:if test="$title != ''">
|
|
300
|
+
<xsl:text>: </xsl:text>
|
|
301
|
+
<xsl:choose>
|
|
302
|
+
<xsl:when test="string-length($title) > 40">
|
|
303
|
+
<xsl:value-of select="substring($title,1,40)"/>
|
|
304
|
+
<xsl:text>...</xsl:text>
|
|
305
|
+
</xsl:when>
|
|
306
|
+
<xsl:otherwise>
|
|
307
|
+
<xsl:value-of select="$title"/>
|
|
308
|
+
</xsl:otherwise>
|
|
309
|
+
</xsl:choose>
|
|
310
|
+
</xsl:if>
|
|
311
|
+
</xsl:message>
|
|
312
|
+
</xsl:if>
|
|
313
|
+
</xsl:template>
|
|
314
|
+
|
|
315
|
+
<xsl:template name="generate.class.attribute">
|
|
316
|
+
<xsl:param name="class" select="local-name(.)"/>
|
|
317
|
+
<xsl:apply-templates select="." mode="class.attribute">
|
|
318
|
+
<xsl:with-param name="class" select="$class"/>
|
|
319
|
+
</xsl:apply-templates>
|
|
320
|
+
</xsl:template>
|
|
321
|
+
|
|
322
|
+
<xsl:template match="*" mode="class.attribute">
|
|
323
|
+
<xsl:param name="class" select="local-name(.)"/>
|
|
324
|
+
<!-- permit customization of class attributes -->
|
|
325
|
+
<!-- Use element name by default -->
|
|
326
|
+
<xsl:variable name="class.value">
|
|
327
|
+
<xsl:apply-templates select="." mode="class.value">
|
|
328
|
+
<xsl:with-param name="class" select="$class"/>
|
|
329
|
+
</xsl:apply-templates>
|
|
330
|
+
</xsl:variable>
|
|
331
|
+
|
|
332
|
+
<xsl:if test="string-length(normalize-space($class.value)) != 0">
|
|
333
|
+
<xsl:attribute name="class">
|
|
334
|
+
<xsl:value-of select="$class.value"/>
|
|
335
|
+
</xsl:attribute>
|
|
336
|
+
</xsl:if>
|
|
337
|
+
</xsl:template>
|
|
338
|
+
|
|
339
|
+
<xsl:template match="*" mode="class.value">
|
|
340
|
+
<xsl:param name="class" select="local-name(.)"/>
|
|
341
|
+
<!-- permit customization of class value only -->
|
|
342
|
+
<!-- Use element name by default -->
|
|
343
|
+
<xsl:value-of select="$class"/>
|
|
344
|
+
</xsl:template>
|
|
345
|
+
|
|
346
|
+
<!-- Apply common attributes such as class, lang, dir -->
|
|
347
|
+
<xsl:template name="common.html.attributes">
|
|
348
|
+
<xsl:param name="inherit" select="0"/>
|
|
349
|
+
<xsl:param name="class" select="local-name(.)"/>
|
|
350
|
+
<xsl:apply-templates select="." mode="common.html.attributes">
|
|
351
|
+
<xsl:with-param name="class" select="$class"/>
|
|
352
|
+
<xsl:with-param name="inherit" select="$inherit"/>
|
|
353
|
+
</xsl:apply-templates>
|
|
354
|
+
</xsl:template>
|
|
355
|
+
|
|
356
|
+
<xsl:template match="*" mode="common.html.attributes">
|
|
357
|
+
<xsl:param name="class" select="local-name(.)"/>
|
|
358
|
+
<xsl:param name="inherit" select="0"/>
|
|
359
|
+
<xsl:call-template name="generate.html.lang"/>
|
|
360
|
+
<xsl:call-template name="dir">
|
|
361
|
+
<xsl:with-param name="inherit" select="$inherit"/>
|
|
362
|
+
</xsl:call-template>
|
|
363
|
+
<xsl:apply-templates select="." mode="class.attribute">
|
|
364
|
+
<xsl:with-param name="class" select="$class"/>
|
|
365
|
+
</xsl:apply-templates>
|
|
366
|
+
<xsl:call-template name="its.attributes">
|
|
367
|
+
<xsl:with-param name="inherit" select="$inherit"/>
|
|
368
|
+
</xsl:call-template>
|
|
369
|
+
</xsl:template>
|
|
370
|
+
|
|
371
|
+
<!-- Apply common attributes not including class -->
|
|
372
|
+
<xsl:template name="locale.html.attributes">
|
|
373
|
+
<xsl:apply-templates select="." mode="locale.html.attributes"/>
|
|
374
|
+
</xsl:template>
|
|
375
|
+
|
|
376
|
+
<xsl:template match="*" mode="locale.html.attributes">
|
|
377
|
+
<xsl:call-template name="generate.html.lang"/>
|
|
378
|
+
<xsl:call-template name="dir"/>
|
|
379
|
+
<xsl:call-template name="its.attributes"/>
|
|
380
|
+
</xsl:template>
|
|
381
|
+
|
|
382
|
+
<!-- Pass through any lang attributes -->
|
|
383
|
+
<xsl:template name="generate.html.lang">
|
|
384
|
+
<xsl:apply-templates select="." mode="html.lang.attribute"/>
|
|
385
|
+
</xsl:template>
|
|
386
|
+
|
|
387
|
+
<xsl:template match="*" mode="html.lang.attribute">
|
|
388
|
+
<!-- match the attribute name to the output type -->
|
|
389
|
+
<xsl:choose>
|
|
390
|
+
<xsl:when test="@lang and $stylesheet.result.type = 'html'">
|
|
391
|
+
<xsl:attribute name="lang">
|
|
392
|
+
<xsl:value-of select="@lang"/>
|
|
393
|
+
</xsl:attribute>
|
|
394
|
+
</xsl:when>
|
|
395
|
+
<xsl:when test="@lang and $stylesheet.result.type = 'xhtml'">
|
|
396
|
+
<xsl:attribute name="xml:lang">
|
|
397
|
+
<xsl:value-of select="@lang"/>
|
|
398
|
+
</xsl:attribute>
|
|
399
|
+
</xsl:when>
|
|
400
|
+
<xsl:when test="@xml:lang and $stylesheet.result.type = 'html'">
|
|
401
|
+
<xsl:attribute name="lang">
|
|
402
|
+
<xsl:value-of select="@xml:lang"/>
|
|
403
|
+
</xsl:attribute>
|
|
404
|
+
</xsl:when>
|
|
405
|
+
<xsl:when test="@xml:lang and $stylesheet.result.type = 'xhtml'">
|
|
406
|
+
<xsl:attribute name="xml:lang">
|
|
407
|
+
<xsl:value-of select="@xml:lang"/>
|
|
408
|
+
</xsl:attribute>
|
|
409
|
+
</xsl:when>
|
|
410
|
+
</xsl:choose>
|
|
411
|
+
</xsl:template>
|
|
412
|
+
|
|
413
|
+
<!-- ==================================================================== -->
|
|
414
|
+
<!-- Insert link to css or insert literal CSS in head element -->
|
|
415
|
+
<xsl:template name="generate.css">
|
|
416
|
+
<xsl:choose>
|
|
417
|
+
<xsl:when test="$generate.css.header = 0">
|
|
418
|
+
<xsl:call-template name="generate.css.links"/>
|
|
419
|
+
</xsl:when>
|
|
420
|
+
<xsl:otherwise>
|
|
421
|
+
<xsl:call-template name="generate.css.headers"/>
|
|
422
|
+
</xsl:otherwise>
|
|
423
|
+
</xsl:choose>
|
|
424
|
+
</xsl:template>
|
|
425
|
+
|
|
426
|
+
<xsl:template name="generate.css.headers">
|
|
427
|
+
<xsl:call-template name="generate.default.css.header"/>
|
|
428
|
+
<xsl:call-template name="generate.custom.css.header"/>
|
|
429
|
+
</xsl:template>
|
|
430
|
+
|
|
431
|
+
<xsl:template name="generate.default.css.header">
|
|
432
|
+
<xsl:if test="$make.clean.html != 0 and $docbook.css.source != ''">
|
|
433
|
+
<!-- Select default file relative to stylesheet -->
|
|
434
|
+
<xsl:variable name="css.node" select="document($docbook.css.source)/*[1]"/>
|
|
435
|
+
|
|
436
|
+
<xsl:call-template name="output.css.header">
|
|
437
|
+
<xsl:with-param name="css.node" select="$css.node"/>
|
|
438
|
+
</xsl:call-template>
|
|
439
|
+
</xsl:if>
|
|
440
|
+
</xsl:template>
|
|
441
|
+
|
|
442
|
+
<xsl:template name="generate.custom.css.header">
|
|
443
|
+
<xsl:if test="$custom.css.source != ''">
|
|
444
|
+
<!-- Select custom file relative to document -->
|
|
445
|
+
<xsl:variable name="css.node" select="document($custom.css.source,.)/*[1]"/>
|
|
446
|
+
|
|
447
|
+
<xsl:call-template name="output.css.header">
|
|
448
|
+
<xsl:with-param name="css.node" select="$css.node"/>
|
|
449
|
+
</xsl:call-template>
|
|
450
|
+
</xsl:if>
|
|
451
|
+
</xsl:template>
|
|
452
|
+
|
|
453
|
+
<xsl:template name="output.css.header">
|
|
454
|
+
<xsl:param name="css.node"/>
|
|
455
|
+
|
|
456
|
+
<xsl:choose>
|
|
457
|
+
<xsl:when test="count($css.node) = 0">
|
|
458
|
+
</xsl:when>
|
|
459
|
+
<xsl:otherwise>
|
|
460
|
+
<style type="text/css">
|
|
461
|
+
<xsl:copy-of select="$css.node/text()"/>
|
|
462
|
+
</style>
|
|
463
|
+
</xsl:otherwise>
|
|
464
|
+
</xsl:choose>
|
|
465
|
+
</xsl:template>
|
|
466
|
+
|
|
467
|
+
<!-- ==================================================================== -->
|
|
468
|
+
<xsl:template name="generate.css.links">
|
|
469
|
+
<xsl:call-template name="generate.default.css.link"/>
|
|
470
|
+
<xsl:call-template name="generate.custom.css.link"/>
|
|
471
|
+
</xsl:template>
|
|
472
|
+
|
|
473
|
+
<xsl:template name="generate.default.css.link">
|
|
474
|
+
<xsl:if test="$make.clean.html != 0 and $docbook.css.link != 0 and $docbook.css.source != ''">
|
|
475
|
+
<xsl:variable name="filename">
|
|
476
|
+
<xsl:call-template name="css.output.filename">
|
|
477
|
+
<xsl:with-param name="src" select="$docbook.css.source"/>
|
|
478
|
+
</xsl:call-template>
|
|
479
|
+
</xsl:variable>
|
|
480
|
+
|
|
481
|
+
<xsl:call-template name="make.css.link">
|
|
482
|
+
<xsl:with-param name="css.filename" select="$filename"/>
|
|
483
|
+
</xsl:call-template>
|
|
484
|
+
</xsl:if>
|
|
485
|
+
</xsl:template>
|
|
486
|
+
|
|
487
|
+
<xsl:template name="generate.custom.css.link">
|
|
488
|
+
<xsl:if test="$custom.css.source != ''">
|
|
489
|
+
<xsl:variable name="filename">
|
|
490
|
+
<xsl:call-template name="css.output.filename">
|
|
491
|
+
<xsl:with-param name="src" select="$custom.css.source"/>
|
|
492
|
+
</xsl:call-template>
|
|
493
|
+
</xsl:variable>
|
|
494
|
+
|
|
495
|
+
<xsl:call-template name="make.css.link">
|
|
496
|
+
<xsl:with-param name="css.filename" select="$filename"/>
|
|
497
|
+
</xsl:call-template>
|
|
498
|
+
</xsl:if>
|
|
499
|
+
</xsl:template>
|
|
500
|
+
|
|
501
|
+
<!-- a CSS link reference must take into account the relative
|
|
502
|
+
path to a CSS file when chunked HTML is output to more than one directory -->
|
|
503
|
+
<xsl:template name="make.css.link">
|
|
504
|
+
<xsl:param name="css.filename" select="''"/>
|
|
505
|
+
|
|
506
|
+
<xsl:variable name="href">
|
|
507
|
+
<xsl:call-template name="relative.path.link">
|
|
508
|
+
<xsl:with-param name="target.pathname" select="$css.filename"/>
|
|
509
|
+
</xsl:call-template>
|
|
510
|
+
</xsl:variable>
|
|
511
|
+
|
|
512
|
+
<xsl:if test="string-length($css.filename) != 0">
|
|
513
|
+
<link rel="stylesheet" type="text/css" href="{$href}"/>
|
|
514
|
+
</xsl:if>
|
|
515
|
+
</xsl:template>
|
|
516
|
+
|
|
517
|
+
<!-- And the same applies to script links -->
|
|
518
|
+
<xsl:template name="make.script.link">
|
|
519
|
+
<xsl:param name="script.filename" select="''"/>
|
|
520
|
+
|
|
521
|
+
<xsl:variable name="src">
|
|
522
|
+
<xsl:call-template name="relative.path.link">
|
|
523
|
+
<xsl:with-param name="target.pathname" select="$script.filename"/>
|
|
524
|
+
</xsl:call-template>
|
|
525
|
+
</xsl:variable>
|
|
526
|
+
|
|
527
|
+
<xsl:if test="string-length($script.filename) != 0">
|
|
528
|
+
<script>
|
|
529
|
+
<xsl:attribute name="src">
|
|
530
|
+
<xsl:value-of select="$src"/>
|
|
531
|
+
</xsl:attribute>
|
|
532
|
+
<xsl:attribute name="type">
|
|
533
|
+
<xsl:value-of select="$html.script.type"/>
|
|
534
|
+
</xsl:attribute>
|
|
535
|
+
<xsl:call-template name="other.script.attributes">
|
|
536
|
+
<xsl:with-param name="script.filename" select="$script.filename"/>
|
|
537
|
+
</xsl:call-template>
|
|
538
|
+
</script>
|
|
539
|
+
</xsl:if>
|
|
540
|
+
</xsl:template>
|
|
541
|
+
|
|
542
|
+
<xsl:template name="other.script.attributes">
|
|
543
|
+
<xsl:param name="script.filename"/>
|
|
544
|
+
<!-- Placeholder template to allow customization to
|
|
545
|
+
insert additional script element attributes if needed -->
|
|
546
|
+
</xsl:template>
|
|
547
|
+
|
|
548
|
+
<xsl:template name="relative.path.link">
|
|
549
|
+
<xsl:param name="target.pathname"/>
|
|
550
|
+
|
|
551
|
+
<xsl:variable name="href.to.uri" select="$target.pathname"/>
|
|
552
|
+
|
|
553
|
+
<xsl:variable name="href.from.uri">
|
|
554
|
+
<xsl:call-template name="href.target.uri">
|
|
555
|
+
<xsl:with-param name="object" select="."/>
|
|
556
|
+
</xsl:call-template>
|
|
557
|
+
</xsl:variable>
|
|
558
|
+
|
|
559
|
+
<xsl:variable name="href.to">
|
|
560
|
+
<xsl:call-template name="trim.common.uri.paths">
|
|
561
|
+
<xsl:with-param name="uriA" select="$href.to.uri"/>
|
|
562
|
+
<xsl:with-param name="uriB" select="$href.from.uri"/>
|
|
563
|
+
<xsl:with-param name="return" select="'A'"/>
|
|
564
|
+
</xsl:call-template>
|
|
565
|
+
</xsl:variable>
|
|
566
|
+
|
|
567
|
+
<xsl:variable name="href.from">
|
|
568
|
+
<xsl:call-template name="trim.common.uri.paths">
|
|
569
|
+
<xsl:with-param name="uriA" select="$href.to.uri"/>
|
|
570
|
+
<xsl:with-param name="uriB" select="$href.from.uri"/>
|
|
571
|
+
<xsl:with-param name="return" select="'B'"/>
|
|
572
|
+
</xsl:call-template>
|
|
573
|
+
</xsl:variable>
|
|
574
|
+
<xsl:variable name="depth">
|
|
575
|
+
<xsl:call-template name="count.uri.path.depth">
|
|
576
|
+
<xsl:with-param name="filename" select="$href.from"/>
|
|
577
|
+
</xsl:call-template>
|
|
578
|
+
</xsl:variable>
|
|
579
|
+
<xsl:variable name="href">
|
|
580
|
+
<xsl:call-template name="copy-string">
|
|
581
|
+
<xsl:with-param name="string" select="'../'"/>
|
|
582
|
+
<xsl:with-param name="count" select="$depth"/>
|
|
583
|
+
</xsl:call-template>
|
|
584
|
+
<xsl:value-of select="$href.to"/>
|
|
585
|
+
</xsl:variable>
|
|
586
|
+
|
|
587
|
+
<xsl:value-of select="$href"/>
|
|
588
|
+
</xsl:template>
|
|
589
|
+
|
|
590
|
+
<!-- ==================================================================== -->
|
|
591
|
+
|
|
592
|
+
<xsl:template name="generate.css.files">
|
|
593
|
+
<xsl:call-template name="generate.default.css.file"/>
|
|
594
|
+
<xsl:call-template name="generate.custom.css.file"/>
|
|
595
|
+
</xsl:template>
|
|
596
|
+
|
|
597
|
+
<xsl:template name="generate.default.css.file">
|
|
598
|
+
<xsl:if test="$make.clean.html != 0 and $generate.css.header = 0 and $docbook.css.source != ''">
|
|
599
|
+
<!-- Select default file relative to stylesheet -->
|
|
600
|
+
<xsl:variable name="css.node" select="document($docbook.css.source)/*[1]"/>
|
|
601
|
+
|
|
602
|
+
<xsl:call-template name="generate.css.file">
|
|
603
|
+
<xsl:with-param name="src" select="$docbook.css.source"/>
|
|
604
|
+
<xsl:with-param name="css.node" select="$css.node"/>
|
|
605
|
+
</xsl:call-template>
|
|
606
|
+
</xsl:if>
|
|
607
|
+
</xsl:template>
|
|
608
|
+
|
|
609
|
+
<xsl:template name="generate.custom.css.file">
|
|
610
|
+
<xsl:if test="$custom.css.source != '' and $generate.css.header = 0">
|
|
611
|
+
<!-- Select custom file relative to document -->
|
|
612
|
+
<xsl:variable name="css.node" select="document($custom.css.source,.)/*[1]"/>
|
|
613
|
+
|
|
614
|
+
<xsl:call-template name="generate.css.file">
|
|
615
|
+
<xsl:with-param name="src" select="$custom.css.source"/>
|
|
616
|
+
<xsl:with-param name="css.node" select="$css.node"/>
|
|
617
|
+
</xsl:call-template>
|
|
618
|
+
</xsl:if>
|
|
619
|
+
</xsl:template>
|
|
620
|
+
|
|
621
|
+
<xsl:template name="generate.css.file">
|
|
622
|
+
<xsl:param name="css.node"/>
|
|
623
|
+
<xsl:param name="src" select="''"/>
|
|
624
|
+
|
|
625
|
+
<xsl:variable name="css.text" select="$css.node/text()"/>
|
|
626
|
+
|
|
627
|
+
<xsl:choose>
|
|
628
|
+
<xsl:when test="count($css.node) = 0">
|
|
629
|
+
<xsl:message>
|
|
630
|
+
<xsl:text>ERROR: no root element for CSS source file'</xsl:text>
|
|
631
|
+
<xsl:value-of select="$src"/>
|
|
632
|
+
<xsl:text>'.</xsl:text>
|
|
633
|
+
</xsl:message>
|
|
634
|
+
</xsl:when>
|
|
635
|
+
<xsl:otherwise>
|
|
636
|
+
<xsl:variable name="filename">
|
|
637
|
+
<xsl:call-template name="css.output.pathname">
|
|
638
|
+
<xsl:with-param name="src" select="$src"/>
|
|
639
|
+
<xsl:with-param name="content" select="$css.node"/>
|
|
640
|
+
</xsl:call-template>
|
|
641
|
+
</xsl:variable>
|
|
642
|
+
|
|
643
|
+
<xsl:call-template name="write.text.chunk">
|
|
644
|
+
<xsl:with-param name="filename" select="$filename"/>
|
|
645
|
+
<xsl:with-param name="content" select="$css.text"/>
|
|
646
|
+
</xsl:call-template>
|
|
647
|
+
|
|
648
|
+
</xsl:otherwise>
|
|
649
|
+
</xsl:choose>
|
|
650
|
+
</xsl:template>
|
|
651
|
+
|
|
652
|
+
<xsl:template name="css.output.filename">
|
|
653
|
+
<xsl:param name="content"/>
|
|
654
|
+
<xsl:param name="src" select="''"/>
|
|
655
|
+
|
|
656
|
+
<xsl:variable name="candidate">
|
|
657
|
+
<xsl:choose>
|
|
658
|
+
<xsl:when test="string-length($src) = 0">
|
|
659
|
+
<xsl:message>
|
|
660
|
+
<xsl:text>ERROR: missing CSS input filename.</xsl:text>
|
|
661
|
+
</xsl:message>
|
|
662
|
+
</xsl:when>
|
|
663
|
+
<xsl:when test="substring($src,string-length($src)-3) = '.xml'">
|
|
664
|
+
<xsl:value-of select="substring($src, 1, string-length($src) - 4)"/>
|
|
665
|
+
</xsl:when>
|
|
666
|
+
<xsl:otherwise>
|
|
667
|
+
<xsl:value-of select="$src"/>
|
|
668
|
+
</xsl:otherwise>
|
|
669
|
+
</xsl:choose>
|
|
670
|
+
</xsl:variable>
|
|
671
|
+
<xsl:value-of select="$candidate"/>
|
|
672
|
+
</xsl:template>
|
|
673
|
+
|
|
674
|
+
<xsl:template name="css.output.pathname">
|
|
675
|
+
<xsl:param name="content"/>
|
|
676
|
+
<xsl:param name="src" select="''"/>
|
|
677
|
+
|
|
678
|
+
<xsl:variable name="file">
|
|
679
|
+
<xsl:call-template name="css.output.filename">
|
|
680
|
+
<xsl:with-param name="content" select="$content"/>
|
|
681
|
+
<xsl:with-param name="src" select="$src"/>
|
|
682
|
+
</xsl:call-template>
|
|
683
|
+
</xsl:variable>
|
|
684
|
+
|
|
685
|
+
<xsl:variable name="path" select="concat($chunk.base.dir, $file)"/>
|
|
686
|
+
<xsl:value-of select="$path"/>
|
|
687
|
+
|
|
688
|
+
</xsl:template>
|
|
689
|
+
|
|
690
|
+
</xsl:stylesheet>
|