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.
Files changed (170) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/CHANGELOG +41 -0
  4. data/README.md +9 -17
  5. data/bin/docbook_xsl_wrapper +9 -14
  6. data/docbook_xsl_wrapper.gemspec +8 -7
  7. data/lib/docbook_xsl_wrapper.rb +24 -1
  8. data/lib/docbook_xsl_wrapper/epub.rb +124 -122
  9. data/lib/docbook_xsl_wrapper/options.rb +1 -1
  10. data/lib/docbook_xsl_wrapper/validate.rb +22 -0
  11. data/lib/docbook_xsl_wrapper/version.rb +1 -1
  12. data/schema/docbookxi.rng +18654 -0
  13. data/spec/docbook_xsl_wrapper/validate_spec.rb +64 -0
  14. data/xsl/AUTHORS +4 -0
  15. data/xsl/COPYING +48 -0
  16. data/xsl/REVISION +1 -0
  17. data/xsl/VERSION.xsl +115 -0
  18. data/xsl/common/addns.xsl +124 -0
  19. data/xsl/common/af.xml +1272 -0
  20. data/xsl/common/am.xml +1272 -0
  21. data/xsl/common/ar.xml +1272 -0
  22. data/xsl/common/as.xml +703 -0
  23. data/xsl/common/ast.xml +703 -0
  24. data/xsl/common/autoidx-kimber.xsl +45 -0
  25. data/xsl/common/autoidx-kosek.xsl +155 -0
  26. data/xsl/common/az.xml +715 -0
  27. data/xsl/common/bg.xml +767 -0
  28. data/xsl/common/bn.xml +1272 -0
  29. data/xsl/common/bn_in.xml +703 -0
  30. data/xsl/common/bs.xml +705 -0
  31. data/xsl/common/ca.xml +703 -0
  32. data/xsl/common/charmap.xsl +222 -0
  33. data/xsl/common/common.xsl +2129 -0
  34. data/xsl/common/cs.xml +743 -0
  35. data/xsl/common/cy.xml +1288 -0
  36. data/xsl/common/da.xml +707 -0
  37. data/xsl/common/de.xml +709 -0
  38. data/xsl/common/el.xml +772 -0
  39. data/xsl/common/en.xml +1272 -0
  40. data/xsl/common/entities.ent +67 -0
  41. data/xsl/common/eo.xml +1272 -0
  42. data/xsl/common/es.xml +719 -0
  43. data/xsl/common/et.xml +1272 -0
  44. data/xsl/common/eu.xml +1272 -0
  45. data/xsl/common/fa.xml +703 -0
  46. data/xsl/common/fi.xml +713 -0
  47. data/xsl/common/fr.xml +733 -0
  48. data/xsl/common/ga.xml +1272 -0
  49. data/xsl/common/gentext.xsl +855 -0
  50. data/xsl/common/gl.xml +1272 -0
  51. data/xsl/common/gu.xml +703 -0
  52. data/xsl/common/he.xml +1272 -0
  53. data/xsl/common/hi.xml +703 -0
  54. data/xsl/common/hr.xml +705 -0
  55. data/xsl/common/hu.xml +721 -0
  56. data/xsl/common/id.xml +1272 -0
  57. data/xsl/common/insertfile.xsl +113 -0
  58. data/xsl/common/is.xml +715 -0
  59. data/xsl/common/it.xml +1272 -0
  60. data/xsl/common/ja.xml +703 -0
  61. data/xsl/common/ka.xml +743 -0
  62. data/xsl/common/kn.xml +1272 -0
  63. data/xsl/common/ko.xml +1272 -0
  64. data/xsl/common/ky.xml +775 -0
  65. data/xsl/common/l10n.dtd +64 -0
  66. data/xsl/common/l10n.xml +78 -0
  67. data/xsl/common/l10n.xsl +598 -0
  68. data/xsl/common/la.xml +1272 -0
  69. data/xsl/common/labels.xsl +933 -0
  70. data/xsl/common/lt.xml +721 -0
  71. data/xsl/common/lv.xml +1272 -0
  72. data/xsl/common/ml.xml +703 -0
  73. data/xsl/common/mn.xml +773 -0
  74. data/xsl/common/mr.xml +703 -0
  75. data/xsl/common/nb.xml +1272 -0
  76. data/xsl/common/nds.xml +709 -0
  77. data/xsl/common/nl.xml +703 -0
  78. data/xsl/common/nn.xml +1272 -0
  79. data/xsl/common/olink.xsl +1284 -0
  80. data/xsl/common/or.xml +1272 -0
  81. data/xsl/common/pa.xml +703 -0
  82. data/xsl/common/pi.xml +168 -0
  83. data/xsl/common/pi.xsl +347 -0
  84. data/xsl/common/pl.xml +721 -0
  85. data/xsl/common/pt.xml +1272 -0
  86. data/xsl/common/pt_br.xml +1272 -0
  87. data/xsl/common/refentry.xsl +1353 -0
  88. data/xsl/common/ro.xml +1272 -0
  89. data/xsl/common/ru.xml +769 -0
  90. data/xsl/common/sk.xml +1272 -0
  91. data/xsl/common/sl.xml +1272 -0
  92. data/xsl/common/sq.xml +1272 -0
  93. data/xsl/common/sr.xml +763 -0
  94. data/xsl/common/sr_Latn.xml +722 -0
  95. data/xsl/common/subtitles.xsl +181 -0
  96. data/xsl/common/sv.xml +707 -0
  97. data/xsl/common/ta.xml +703 -0
  98. data/xsl/common/table.xsl +515 -0
  99. data/xsl/common/targetdatabase.dtd +49 -0
  100. data/xsl/common/targets.xsl +338 -0
  101. data/xsl/common/te.xml +703 -0
  102. data/xsl/common/th.xml +1272 -0
  103. data/xsl/common/titles.xsl +850 -0
  104. data/xsl/common/tl.xml +1272 -0
  105. data/xsl/common/tr.xml +709 -0
  106. data/xsl/common/uk.xml +769 -0
  107. data/xsl/common/ur.xml +705 -0
  108. data/xsl/common/utility.xsl +291 -0
  109. data/xsl/common/vi.xml +1272 -0
  110. data/xsl/common/xh.xml +1272 -0
  111. data/xsl/common/zh.xml +703 -0
  112. data/xsl/common/zh_cn.xml +703 -0
  113. data/xsl/common/zh_tw.xml +703 -0
  114. data/xsl/epub/docbook.xsl +1769 -0
  115. data/xsl/epub3/chunk.xsl +30 -0
  116. data/xsl/epub3/docbook-epub.css.xml +142 -0
  117. data/xsl/epub3/docbook.xsl +20 -0
  118. data/xsl/epub3/epub3-chunk-mods.xsl +52 -0
  119. data/xsl/epub3/epub3-element-mods.xsl +2533 -0
  120. data/xsl/epub3/titlepage.templates.xml +712 -0
  121. data/xsl/epub3/titlepage.templates.xsl +3842 -0
  122. data/xsl/lib/lib.xsl +533 -0
  123. data/xsl/xhtml/admon.xsl +142 -0
  124. data/xsl/xhtml/annotations.xsl +160 -0
  125. data/xsl/xhtml/autoidx.xsl +831 -0
  126. data/xsl/xhtml/autotoc.xsl +706 -0
  127. data/xsl/xhtml/biblio-iso690.xsl +1302 -0
  128. data/xsl/xhtml/biblio.xsl +1371 -0
  129. data/xsl/xhtml/block.xsl +584 -0
  130. data/xsl/xhtml/callout.xsl +210 -0
  131. data/xsl/xhtml/chunk-code.xsl +675 -0
  132. data/xsl/xhtml/chunk-common.xsl +1627 -0
  133. data/xsl/xhtml/chunker.xsl +317 -0
  134. data/xsl/xhtml/component.xsl +440 -0
  135. data/xsl/xhtml/division.xsl +214 -0
  136. data/xsl/xhtml/ebnf.xsl +331 -0
  137. data/xsl/xhtml/footnote.xsl +346 -0
  138. data/xsl/xhtml/formal.xsl +496 -0
  139. data/xsl/xhtml/glossary.xsl +602 -0
  140. data/xsl/xhtml/graphics.xsl +1537 -0
  141. data/xsl/xhtml/html-rtf.xsl +321 -0
  142. data/xsl/xhtml/html.xsl +690 -0
  143. data/xsl/xhtml/htmltbl.xsl +102 -0
  144. data/xsl/xhtml/index.xsl +264 -0
  145. data/xsl/xhtml/info.xsl +48 -0
  146. data/xsl/xhtml/inline.xsl +1508 -0
  147. data/xsl/xhtml/its.xsl +109 -0
  148. data/xsl/xhtml/keywords.xsl +38 -0
  149. data/xsl/xhtml/lists.xsl +1227 -0
  150. data/xsl/xhtml/math.xsl +286 -0
  151. data/xsl/xhtml/param.xsl +449 -0
  152. data/xsl/xhtml/pi.xsl +1237 -0
  153. data/xsl/xhtml/qandaset.xsl +440 -0
  154. data/xsl/xhtml/refentry.xsl +307 -0
  155. data/xsl/xhtml/sections.xsl +564 -0
  156. data/xsl/xhtml/synop.xsl +1623 -0
  157. data/xsl/xhtml/table.xsl +1179 -0
  158. data/xsl/xhtml/task.xsl +76 -0
  159. data/xsl/xhtml/titlepage.templates.xsl +4005 -0
  160. data/xsl/xhtml/titlepage.xsl +1108 -0
  161. data/xsl/xhtml/toc.xsl +334 -0
  162. data/xsl/xhtml/verbatim.xsl +389 -0
  163. data/xsl/xhtml/xref.xsl +1268 -0
  164. data/xsl/xhtml5/docbook.xsl +22 -0
  165. data/xsl/xhtml5/html5-chunk-mods.xsl +112 -0
  166. data/xsl/xhtml5/html5-element-mods.xsl +791 -0
  167. data/xsl/xhtml5/xhtml-docbook.xsl +531 -0
  168. metadata +207 -27
  169. data/.rvmrc +0 -48
  170. data/xslt/obfuscate.xsl +0 -12
@@ -0,0 +1,346 @@
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:d="http://docbook.org/ns/docbook"
5
+ xmlns:exsl="http://exslt.org/common" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="exsl d" version="1.0">
6
+
7
+ <!-- ********************************************************************
8
+ $Id: footnote.xsl 9665 2012-11-08 14:26:20Z kosek $
9
+ ********************************************************************
10
+
11
+ This file is part of the XSL DocBook Stylesheet distribution.
12
+ See ../README or http://docbook.sf.net/release/xsl/current/ for
13
+ copyright and other information.
14
+
15
+ ******************************************************************** -->
16
+
17
+ <!-- This template generates just the footnote marker inline.
18
+ The footnote text is handled in name="process.footnote".
19
+ The footnote marker gets an id of @id, while the
20
+ footnote text gets an id of #ftn.@id. They cross link to each other. -->
21
+ <xsl:template match="d:footnote">
22
+ <xsl:variable name="name">
23
+ <xsl:call-template name="object.id">
24
+ <xsl:with-param name="conditional" select="0"/>
25
+ </xsl:call-template>
26
+ </xsl:variable>
27
+ <xsl:variable name="href">
28
+ <xsl:text>#ftn.</xsl:text>
29
+ <xsl:value-of select="$name"/>
30
+ </xsl:variable>
31
+
32
+ <a href="{$href}">
33
+ <xsl:apply-templates select="." mode="class.attribute"/>
34
+ <xsl:if test="$generate.id.attributes = 0">
35
+ <xsl:attribute name="id">
36
+ <xsl:value-of select="$name"/>
37
+ </xsl:attribute>
38
+ </xsl:if>
39
+
40
+ <sup>
41
+ <xsl:apply-templates select="." mode="class.attribute"/>
42
+ <xsl:call-template name="id.attribute">
43
+ <xsl:with-param name="conditional" select="0"/>
44
+ </xsl:call-template>
45
+ <xsl:text>[</xsl:text>
46
+ <xsl:apply-templates select="." mode="footnote.number"/>
47
+ <xsl:text>]</xsl:text>
48
+ </sup>
49
+ </a>
50
+ </xsl:template>
51
+
52
+ <xsl:template match="d:footnoteref">
53
+ <xsl:variable name="targets" select="key('id',@linkend)"/>
54
+ <xsl:variable name="footnote" select="$targets[1]"/>
55
+
56
+ <xsl:if test="not(local-name($footnote) = 'footnote')">
57
+ <xsl:message terminate="yes">
58
+ ERROR: A footnoteref element has a linkend that points to an element that is not a footnote.
59
+ Typically this happens when an id attribute is accidentally applied to the child of a footnote element.
60
+ target element: <xsl:value-of select="local-name($footnote)"/>
61
+ linkend/id: <xsl:value-of select="@linkend"/>
62
+ </xsl:message>
63
+ </xsl:if>
64
+
65
+ <xsl:variable name="target.href">
66
+ <xsl:call-template name="href.target">
67
+ <xsl:with-param name="object" select="$footnote"/>
68
+ </xsl:call-template>
69
+ </xsl:variable>
70
+
71
+ <xsl:variable name="href">
72
+ <xsl:value-of select="substring-before($target.href, '#')"/>
73
+ <xsl:text>#ftn.</xsl:text>
74
+ <xsl:value-of select="substring-after($target.href, '#')"/>
75
+ </xsl:variable>
76
+
77
+ <a href="{$href}">
78
+ <xsl:apply-templates select="." mode="class.attribute"/>
79
+ <xsl:call-template name="id.attribute"/>
80
+ <sup>
81
+ <xsl:apply-templates select="." mode="class.attribute"/>
82
+ <xsl:text>[</xsl:text>
83
+ <xsl:apply-templates select="$footnote" mode="footnote.number"/>
84
+ <xsl:text>]</xsl:text>
85
+ </sup>
86
+ </a>
87
+ </xsl:template>
88
+
89
+ <xsl:template match="d:footnote" mode="footnote.number">
90
+ <xsl:choose>
91
+ <xsl:when test="string-length(@label) != 0">
92
+ <xsl:value-of select="@label"/>
93
+ </xsl:when>
94
+ <xsl:when test="ancestor::d:table or ancestor::d:informaltable">
95
+ <xsl:variable name="tfnum">
96
+ <xsl:number level="any" from="d:table|d:informaltable" format="1"/>
97
+ </xsl:variable>
98
+
99
+ <xsl:choose>
100
+ <xsl:when test="string-length($table.footnote.number.symbols) &gt;= $tfnum">
101
+ <xsl:value-of select="substring($table.footnote.number.symbols, $tfnum, 1)"/>
102
+ </xsl:when>
103
+ <xsl:otherwise>
104
+ <xsl:number level="any" from="d:table | d:informaltable" format="{$table.footnote.number.format}"/>
105
+ </xsl:otherwise>
106
+ </xsl:choose>
107
+ </xsl:when>
108
+ <xsl:otherwise>
109
+ <xsl:variable name="pfoot" select="preceding::d:footnote[not(@label)]"/>
110
+ <xsl:variable name="ptfoot" select="preceding::d:table//d:footnote | preceding::d:informaltable//d:footnote"/>
111
+ <xsl:variable name="fnum" select="count($pfoot) - count($ptfoot) + 1"/>
112
+
113
+ <xsl:choose>
114
+ <xsl:when test="string-length($footnote.number.symbols) &gt;= $fnum">
115
+ <xsl:value-of select="substring($footnote.number.symbols, $fnum, 1)"/>
116
+ </xsl:when>
117
+ <xsl:otherwise>
118
+ <xsl:number value="$fnum" format="{$footnote.number.format}"/>
119
+ </xsl:otherwise>
120
+ </xsl:choose>
121
+ </xsl:otherwise>
122
+ </xsl:choose>
123
+ </xsl:template>
124
+
125
+ <!-- ==================================================================== -->
126
+
127
+ <xsl:template match="d:footnote/d:para[1]|d:footnote/d:simpara[1]" priority="2">
128
+ <!-- this only works if the first thing in a footnote is a para, -->
129
+ <!-- which is ok, because it usually is. -->
130
+ <xsl:variable name="href">
131
+ <xsl:text>#</xsl:text>
132
+ <xsl:call-template name="object.id">
133
+ <xsl:with-param name="object" select="ancestor::d:footnote"/>
134
+ </xsl:call-template>
135
+ </xsl:variable>
136
+
137
+ <xsl:call-template name="paragraph">
138
+ <xsl:with-param name="class">
139
+ <xsl:if test="@role and $para.propagates.style != 0">
140
+ <xsl:value-of select="@role"/>
141
+ </xsl:if>
142
+ </xsl:with-param>
143
+ <xsl:with-param name="content">
144
+ <a href="{$href}">
145
+ <xsl:apply-templates select="." mode="class.attribute"/>
146
+ <sup>
147
+ <xsl:apply-templates select="." mode="class.attribute"/>
148
+ <xsl:text>[</xsl:text>
149
+ <xsl:apply-templates select="ancestor::d:footnote" mode="footnote.number"/>
150
+ <xsl:text>] </xsl:text>
151
+ </sup>
152
+ </a>
153
+ <xsl:apply-templates/>
154
+ </xsl:with-param>
155
+ </xsl:call-template>
156
+
157
+ </xsl:template>
158
+
159
+ <!-- ==================================================================== -->
160
+
161
+ <xsl:template match="*" mode="footnote.body.number">
162
+ <xsl:variable name="name">
163
+ <xsl:text>ftn.</xsl:text>
164
+ <xsl:call-template name="object.id">
165
+ <xsl:with-param name="object" select="ancestor::d:footnote"/>
166
+ </xsl:call-template>
167
+ </xsl:variable>
168
+ <xsl:variable name="href">
169
+ <xsl:text>#</xsl:text>
170
+ <xsl:call-template name="object.id">
171
+ <xsl:with-param name="object" select="ancestor::d:footnote"/>
172
+ </xsl:call-template>
173
+ </xsl:variable>
174
+ <xsl:variable name="footnote.mark">
175
+ <a href="{$href}">
176
+ <xsl:apply-templates select="." mode="class.attribute"/>
177
+ <xsl:choose>
178
+ <xsl:when test="$generate.id.attributes = 0">
179
+ <xsl:if test="@id or @xml:id">
180
+ <xsl:attribute name="id">
181
+ <xsl:value-of select="@id|@xml:id"/>
182
+ </xsl:attribute>
183
+ </xsl:if>
184
+ </xsl:when>
185
+ <xsl:otherwise>
186
+ <xsl:call-template name="id.attribute"/>
187
+ </xsl:otherwise>
188
+ </xsl:choose>
189
+ <sup>
190
+ <xsl:text>[</xsl:text>
191
+ <xsl:apply-templates select="ancestor::d:footnote" mode="footnote.number"/>
192
+ <xsl:text>] </xsl:text>
193
+ </sup>
194
+ </a>
195
+ </xsl:variable>
196
+
197
+ <xsl:variable name="html">
198
+ <xsl:apply-templates select="."/>
199
+ </xsl:variable>
200
+
201
+ <xsl:choose>
202
+ <xsl:when test="$exsl.node.set.available != 0">
203
+ <xsl:variable name="html-nodes" select="exsl:node-set($html)"/>
204
+ <xsl:choose>
205
+ <xsl:when test="$html-nodes//p">
206
+ <xsl:apply-templates select="$html-nodes" mode="insert.html.p">
207
+ <xsl:with-param name="mark" select="$footnote.mark"/>
208
+ </xsl:apply-templates>
209
+ </xsl:when>
210
+ <xsl:otherwise>
211
+ <xsl:apply-templates select="$html-nodes" mode="insert.html.text">
212
+ <xsl:with-param name="mark" select="$footnote.mark"/>
213
+ </xsl:apply-templates>
214
+ </xsl:otherwise>
215
+ </xsl:choose>
216
+ </xsl:when>
217
+ <xsl:otherwise>
218
+ <xsl:copy-of select="$html"/>
219
+ </xsl:otherwise>
220
+ </xsl:choose>
221
+ </xsl:template>
222
+
223
+ <!-- ==================================================================== -->
224
+
225
+ <!--
226
+ <xsl:template name="count-element-from">
227
+ <xsl:param name="from" select=".."/>
228
+ <xsl:param name="to" select="."/>
229
+ <xsl:param name="count" select="0"/>
230
+ <xsl:param name="list" select="$from/following::*[local-name(.)=local-name($to)]
231
+ |$from/descendant-or-self::*[local-name(.)=local-name($to)]"/>
232
+
233
+ <xsl:choose>
234
+ <xsl:when test="not($list)">
235
+ <xsl:text>-1</xsl:text>
236
+ </xsl:when>
237
+ <xsl:when test="$list[1] = $to">
238
+ <xsl:value-of select="$count + 1"/>
239
+ </xsl:when>
240
+ <xsl:otherwise>
241
+ </xsl:otherwise>
242
+ </xsl:choose>
243
+ </xsl:template>
244
+ -->
245
+
246
+ <!-- ==================================================================== -->
247
+
248
+ <xsl:template name="process.footnotes">
249
+ <xsl:variable name="footnotes" select=".//d:footnote"/>
250
+ <xsl:variable name="table.footnotes" select=".//d:table//d:footnote | .//d:informaltable//d:footnote"/>
251
+
252
+ <!-- Only bother to do this if there's at least one non-table footnote -->
253
+ <xsl:if test="count($footnotes)&gt;count($table.footnotes)">
254
+ <div class="footnotes">
255
+ <xsl:call-template name="footnotes.attributes"/>
256
+ <br/>
257
+ <hr>
258
+ <xsl:choose>
259
+ <xsl:when test="$make.clean.html != 0">
260
+ <xsl:attribute name="class">footnote-hr</xsl:attribute>
261
+ </xsl:when>
262
+ <xsl:when test="$css.decoration != 0">
263
+ <xsl:attribute name="style">
264
+ <xsl:value-of select="concat('width:100; text-align:', $direction.align.start, ';', 'margin-', $direction.align.start, ': 0')"/>
265
+ </xsl:attribute>
266
+ </xsl:when>
267
+ <xsl:otherwise>
268
+ <xsl:attribute name="width">100</xsl:attribute>
269
+ <xsl:attribute name="align"><xsl:value-of select="$direction.align.start"/></xsl:attribute>
270
+ </xsl:otherwise>
271
+ </xsl:choose>
272
+ </hr>
273
+ <xsl:apply-templates select="$footnotes" mode="process.footnote.mode"/>
274
+ </div>
275
+ </xsl:if>
276
+
277
+ <xsl:if test="$annotation.support != 0 and //d:annotation">
278
+ <div class="annotation-list">
279
+ <div class="annotation-nocss">
280
+ <p>The following annotations are from this essay. You are seeing
281
+ them here because your browser doesn&#8217;t support the user-interface
282
+ techniques used to make them appear as &#8216;popups&#8217; on modern browsers.</p>
283
+ </div>
284
+
285
+ <xsl:apply-templates select="//d:annotation" mode="annotation-popup"/>
286
+ </div>
287
+ </xsl:if>
288
+ </xsl:template>
289
+
290
+ <xsl:template name="footnotes.attributes">
291
+ <!-- customizable for footnotes attributes -->
292
+ </xsl:template>
293
+
294
+ <xsl:template name="process.chunk.footnotes">
295
+ <!-- nop -->
296
+ </xsl:template>
297
+
298
+ <xsl:template match="d:footnote" name="process.footnote" mode="process.footnote.mode">
299
+ <xsl:variable name="id">
300
+ <xsl:text>ftn.</xsl:text>
301
+ <xsl:call-template name="object.id">
302
+ <xsl:with-param name="conditional" select="0"/>
303
+ </xsl:call-template>
304
+ </xsl:variable>
305
+
306
+ <xsl:choose>
307
+ <xsl:when test="local-name(*[1]) = 'para' or local-name(*[1]) = 'simpara'">
308
+ <div id="{$id}">
309
+ <xsl:call-template name="common.html.attributes"/>
310
+ <xsl:apply-templates/>
311
+ </div>
312
+ </xsl:when>
313
+
314
+ <xsl:when test="$html.cleanup != 0 and $exsl.node.set.available != 0">
315
+ <div id="{$id}">
316
+ <xsl:call-template name="common.html.attributes"/>
317
+ <xsl:call-template name="id.attribute"/>
318
+ <xsl:apply-templates select="*[1]" mode="footnote.body.number"/>
319
+ <xsl:apply-templates select="*[position() &gt; 1]"/>
320
+ </div>
321
+ </xsl:when>
322
+
323
+ <xsl:otherwise>
324
+ <xsl:message>
325
+ <xsl:text>Warning: footnote number may not be generated </xsl:text>
326
+ <xsl:text>correctly; </xsl:text>
327
+ <xsl:value-of select="local-name(*[1])"/>
328
+ <xsl:text> unexpected as first child of footnote.</xsl:text>
329
+ </xsl:message>
330
+ <div id="{$id}">
331
+ <xsl:call-template name="common.html.attributes"/>
332
+ <xsl:call-template name="id.attribute"/>
333
+ <xsl:apply-templates/>
334
+ </div>
335
+ </xsl:otherwise>
336
+ </xsl:choose>
337
+ </xsl:template>
338
+
339
+ <xsl:template match="d:table//d:footnote | d:informaltable//d:footnote" mode="process.footnote.mode">
340
+ </xsl:template>
341
+
342
+ <xsl:template match="d:footnote" mode="table.footnote.mode">
343
+ <xsl:call-template name="process.footnote"/>
344
+ </xsl:template>
345
+
346
+ </xsl:stylesheet>
@@ -0,0 +1,496 @@
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: formal.xsl 9501 2012-07-16 00:14:50Z bobstayton $
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
+ <xsl:param name="formal.object.break.after">1</xsl:param>
19
+
20
+ <xsl:template name="formal.object">
21
+ <xsl:param name="placement" select="'before'"/>
22
+ <xsl:param name="class">
23
+ <xsl:apply-templates select="." mode="class.value"/>
24
+ </xsl:param>
25
+
26
+ <xsl:call-template name="id.warning"/>
27
+
28
+ <xsl:variable name="content">
29
+ <div class="{$class}">
30
+ <xsl:call-template name="id.attribute">
31
+ <xsl:with-param name="conditional" select="0"/>
32
+ </xsl:call-template>
33
+ <xsl:call-template name="anchor">
34
+ <xsl:with-param name="conditional" select="0"/>
35
+ </xsl:call-template>
36
+
37
+ <xsl:choose>
38
+ <xsl:when test="$placement = 'before'">
39
+ <xsl:call-template name="formal.object.heading"/>
40
+ <div class="{$class}-contents">
41
+ <xsl:apply-templates/>
42
+ </div>
43
+ <!-- HACK: This doesn't belong inside formal.object; it
44
+ should be done by the table template, but I want
45
+ the link to be inside the DIV, so... -->
46
+ <xsl:if test="local-name(.) = 'table'">
47
+ <xsl:call-template name="table.longdesc"/>
48
+ </xsl:if>
49
+
50
+ <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
51
+ </xsl:when>
52
+ <xsl:otherwise>
53
+ <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
54
+ <div class="{$class}-contents"><xsl:apply-templates/></div>
55
+ <!-- HACK: This doesn't belong inside formal.object; it
56
+ should be done by the table template, but I want
57
+ the link to be inside the DIV, so... -->
58
+ <xsl:if test="local-name(.) = 'table'">
59
+ <xsl:call-template name="table.longdesc"/>
60
+ </xsl:if>
61
+
62
+ <xsl:call-template name="formal.object.heading"/>
63
+ </xsl:otherwise>
64
+ </xsl:choose>
65
+ </div>
66
+ <xsl:if test="not($formal.object.break.after = '0')">
67
+ <br class="{$class}-break"/>
68
+ </xsl:if>
69
+ </xsl:variable>
70
+
71
+ <xsl:variable name="floatstyle">
72
+ <xsl:call-template name="floatstyle"/>
73
+ </xsl:variable>
74
+
75
+ <xsl:choose>
76
+ <xsl:when test="$floatstyle != ''">
77
+ <xsl:call-template name="floater">
78
+ <xsl:with-param name="class"><xsl:value-of select="$class"/>-float</xsl:with-param>
79
+ <xsl:with-param name="floatstyle" select="$floatstyle"/>
80
+ <xsl:with-param name="content" select="$content"/>
81
+ </xsl:call-template>
82
+ </xsl:when>
83
+ <xsl:otherwise>
84
+ <xsl:copy-of select="$content"/>
85
+ </xsl:otherwise>
86
+ </xsl:choose>
87
+
88
+ </xsl:template>
89
+
90
+ <xsl:template name="formal.object.heading">
91
+ <xsl:param name="object" select="."/>
92
+ <xsl:param name="title">
93
+ <xsl:apply-templates select="$object" mode="object.title.markup">
94
+ <xsl:with-param name="allow-anchors" select="1"/>
95
+ </xsl:apply-templates>
96
+ </xsl:param>
97
+
98
+
99
+ <xsl:choose>
100
+ <xsl:when test="$make.clean.html != 0">
101
+ <xsl:variable name="html.class" select="concat(local-name($object),'-title')"/>
102
+ <div class="{$html.class}">
103
+ <xsl:copy-of select="$title"/>
104
+ </div>
105
+ </xsl:when>
106
+ <xsl:otherwise>
107
+ <p class="title">
108
+ <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
109
+ <xsl:copy-of select="$title"/>
110
+ </strong>
111
+ </p>
112
+ </xsl:otherwise>
113
+ </xsl:choose>
114
+ </xsl:template>
115
+
116
+ <xsl:template name="informal.object">
117
+ <xsl:param name="class">
118
+ <xsl:apply-templates select="." mode="class.value"/>
119
+ </xsl:param>
120
+
121
+ <xsl:variable name="content">
122
+ <div class="{$class}">
123
+ <xsl:call-template name="id.attribute"/>
124
+ <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
125
+ <xsl:call-template name="anchor"/>
126
+ <xsl:apply-templates/>
127
+
128
+ <!-- HACK: This doesn't belong inside formal.object; it
129
+ should be done by the table template, but I want
130
+ the link to be inside the DIV, so... -->
131
+ <xsl:if test="local-name(.) = 'informaltable'">
132
+ <xsl:call-template name="table.longdesc"/>
133
+ </xsl:if>
134
+
135
+ <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
136
+ </div>
137
+ </xsl:variable>
138
+
139
+ <xsl:variable name="floatstyle">
140
+ <xsl:call-template name="floatstyle"/>
141
+ </xsl:variable>
142
+
143
+ <xsl:choose>
144
+ <xsl:when test="$floatstyle != ''">
145
+ <xsl:call-template name="floater">
146
+ <xsl:with-param name="class"><xsl:value-of select="$class"/>-float</xsl:with-param>
147
+ <xsl:with-param name="floatstyle" select="$floatstyle"/>
148
+ <xsl:with-param name="content" select="$content"/>
149
+ </xsl:call-template>
150
+ </xsl:when>
151
+ <xsl:otherwise>
152
+ <xsl:copy-of select="$content"/>
153
+ </xsl:otherwise>
154
+ </xsl:choose>
155
+
156
+ </xsl:template>
157
+
158
+ <xsl:template name="semiformal.object">
159
+ <xsl:param name="placement" select="'before'"/>
160
+ <xsl:param name="class" select="local-name(.)"/>
161
+
162
+ <xsl:choose>
163
+ <xsl:when test="d:title or d:info/d:title">
164
+ <xsl:call-template name="formal.object">
165
+ <xsl:with-param name="placement" select="$placement"/>
166
+ <xsl:with-param name="class" select="$class"/>
167
+ </xsl:call-template>
168
+ </xsl:when>
169
+ <xsl:otherwise>
170
+ <xsl:call-template name="informal.object">
171
+ <xsl:with-param name="class" select="$class"/>
172
+ </xsl:call-template>
173
+ </xsl:otherwise>
174
+ </xsl:choose>
175
+ </xsl:template>
176
+
177
+ <xsl:template match="d:figure">
178
+ <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
179
+
180
+ <xsl:variable name="placement">
181
+ <xsl:choose>
182
+ <xsl:when test="contains($param.placement, ' ')">
183
+ <xsl:value-of select="substring-before($param.placement, ' ')"/>
184
+ </xsl:when>
185
+ <xsl:when test="$param.placement = ''">before</xsl:when>
186
+ <xsl:otherwise>
187
+ <xsl:value-of select="$param.placement"/>
188
+ </xsl:otherwise>
189
+ </xsl:choose>
190
+ </xsl:variable>
191
+
192
+ <xsl:call-template name="formal.object">
193
+ <xsl:with-param name="placement" select="$placement"/>
194
+ </xsl:call-template>
195
+
196
+ </xsl:template>
197
+
198
+ <xsl:template match="d:table">
199
+ <xsl:choose>
200
+ <xsl:when test="d:tgroup|d:mediaobject|d:graphic">
201
+ <xsl:call-template name="calsTable"/>
202
+ </xsl:when>
203
+ <xsl:when test="d:caption">
204
+ <xsl:call-template name="htmlTable.with.caption"/>
205
+ </xsl:when>
206
+ <xsl:otherwise>
207
+ <!-- do not use xsl:copy because of XHTML's needs -->
208
+ <div>
209
+ <xsl:call-template name="generate.class.attribute"/>
210
+ <xsl:call-template name="id.attribute"/>
211
+ <xsl:call-template name="anchor"/>
212
+ <xsl:element name="table" namespace="http://www.w3.org/1999/xhtml">
213
+ <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
214
+ <xsl:call-template name="htmlTable"/>
215
+ </xsl:element>
216
+ </div>
217
+ </xsl:otherwise>
218
+ </xsl:choose>
219
+ </xsl:template>
220
+
221
+ <!-- Handle html markup table like formal.object -->
222
+ <xsl:template name="htmlTable.with.caption">
223
+ <xsl:param name="class">
224
+ <xsl:apply-templates select="." mode="class.value"/>
225
+ </xsl:param>
226
+
227
+ <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
228
+
229
+ <xsl:variable name="placement">
230
+ <xsl:choose>
231
+ <xsl:when test="contains($param.placement, ' ')">
232
+ <xsl:value-of select="substring-before($param.placement, ' ')"/>
233
+ </xsl:when>
234
+ <xsl:when test="$param.placement = ''">before</xsl:when>
235
+ <xsl:otherwise>
236
+ <xsl:value-of select="$param.placement"/>
237
+ </xsl:otherwise>
238
+ </xsl:choose>
239
+ </xsl:variable>
240
+
241
+ <xsl:call-template name="id.warning"/>
242
+
243
+ <xsl:variable name="content">
244
+ <div class="{$class}">
245
+ <xsl:call-template name="id.attribute">
246
+ <xsl:with-param name="conditional" select="0"/>
247
+ </xsl:call-template>
248
+ <xsl:call-template name="anchor">
249
+ <xsl:with-param name="conditional" select="0"/>
250
+ </xsl:call-template>
251
+
252
+ <xsl:choose>
253
+ <xsl:when test="$placement = 'before'">
254
+
255
+ <xsl:call-template name="formal.object.heading"/>
256
+
257
+ <div class="{$class}-contents">
258
+ <xsl:apply-templates select="." mode="htmlTable"/>
259
+ </div>
260
+
261
+ <xsl:call-template name="table.longdesc"/>
262
+
263
+ <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
264
+ </xsl:when>
265
+ <xsl:otherwise>
266
+ <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
267
+
268
+ <div class="{$class}-contents">
269
+ <xsl:apply-templates select="." mode="htmlTable"/>
270
+ </div>
271
+
272
+ <xsl:call-template name="table.longdesc"/>
273
+
274
+ <xsl:call-template name="formal.object.heading"/>
275
+ </xsl:otherwise>
276
+ </xsl:choose>
277
+ </div>
278
+ <xsl:if test="not($formal.object.break.after = '0')">
279
+ <br class="{$class}-break"/>
280
+ </xsl:if>
281
+ </xsl:variable>
282
+
283
+ <xsl:variable name="floatstyle">
284
+ <xsl:call-template name="floatstyle"/>
285
+ </xsl:variable>
286
+
287
+ <xsl:choose>
288
+ <xsl:when test="$floatstyle != ''">
289
+ <xsl:call-template name="floater">
290
+ <xsl:with-param name="class"><xsl:value-of select="$class"/>-float</xsl:with-param>
291
+ <xsl:with-param name="floatstyle" select="$floatstyle"/>
292
+ <xsl:with-param name="content" select="$content"/>
293
+ </xsl:call-template>
294
+ </xsl:when>
295
+ <xsl:otherwise>
296
+ <xsl:copy-of select="$content"/>
297
+ </xsl:otherwise>
298
+ </xsl:choose>
299
+
300
+ </xsl:template>
301
+
302
+ <xsl:template name="calsTable">
303
+ <xsl:if test="d:tgroup/d:tbody/d:tr |d:tgroup/d:thead/d:tr |d:tgroup/d:tfoot/d:tr">
304
+ <xsl:message terminate="yes">Broken table: tr descendent of CALS Table.</xsl:message>
305
+ </xsl:if>
306
+
307
+ <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
308
+
309
+ <xsl:variable name="placement">
310
+ <xsl:choose>
311
+ <xsl:when test="contains($param.placement, ' ')">
312
+ <xsl:value-of select="substring-before($param.placement, ' ')"/>
313
+ </xsl:when>
314
+ <xsl:when test="$param.placement = ''">before</xsl:when>
315
+ <xsl:otherwise>
316
+ <xsl:value-of select="$param.placement"/>
317
+ </xsl:otherwise>
318
+ </xsl:choose>
319
+ </xsl:variable>
320
+
321
+ <xsl:call-template name="formal.object">
322
+ <xsl:with-param name="placement" select="$placement"/>
323
+ </xsl:call-template>
324
+ </xsl:template>
325
+
326
+ <xsl:template match="d:table|d:informaltable" mode="class.value">
327
+ <xsl:choose>
328
+ <xsl:when test="@tabstyle">
329
+ <xsl:value-of select="@tabstyle"/>
330
+ </xsl:when>
331
+ <xsl:otherwise>
332
+ <xsl:value-of select="local-name(.)"/>
333
+ </xsl:otherwise>
334
+ </xsl:choose>
335
+ </xsl:template>
336
+
337
+ <xsl:template name="htmlTable">
338
+ <xsl:if test="d:tgroup/d:tbody/d:row |d:tgroup/d:thead/d:row |d:tgroup/d:tfoot/d:row">
339
+ <xsl:message terminate="yes">Broken table: row descendent of HTML table.</xsl:message>
340
+ </xsl:if>
341
+
342
+ <xsl:apply-templates mode="htmlTable"/>
343
+
344
+ <xsl:if test=".//d:footnote|../d:title//d:footnote">
345
+ <tbody class="footnotes">
346
+ <tr>
347
+ <td colspan="50">
348
+ <xsl:apply-templates select=".//d:footnote|../d:title//d:footnote" mode="table.footnote.mode"/>
349
+ </td>
350
+ </tr>
351
+ </tbody>
352
+ </xsl:if>
353
+ </xsl:template>
354
+
355
+ <xsl:template match="d:example">
356
+ <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
357
+
358
+ <xsl:variable name="placement">
359
+ <xsl:choose>
360
+ <xsl:when test="contains($param.placement, ' ')">
361
+ <xsl:value-of select="substring-before($param.placement, ' ')"/>
362
+ </xsl:when>
363
+ <xsl:when test="$param.placement = ''">before</xsl:when>
364
+ <xsl:otherwise>
365
+ <xsl:value-of select="$param.placement"/>
366
+ </xsl:otherwise>
367
+ </xsl:choose>
368
+ </xsl:variable>
369
+
370
+ <xsl:call-template name="formal.object">
371
+ <xsl:with-param name="placement" select="$placement"/>
372
+ </xsl:call-template>
373
+
374
+ </xsl:template>
375
+
376
+ <xsl:template match="d:equation">
377
+ <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
378
+
379
+ <xsl:variable name="placement">
380
+ <xsl:choose>
381
+ <xsl:when test="contains($param.placement, ' ')">
382
+ <xsl:value-of select="substring-before($param.placement, ' ')"/>
383
+ </xsl:when>
384
+ <xsl:when test="$param.placement = ''">before</xsl:when>
385
+ <xsl:otherwise>
386
+ <xsl:value-of select="$param.placement"/>
387
+ </xsl:otherwise>
388
+ </xsl:choose>
389
+ </xsl:variable>
390
+
391
+ <xsl:call-template name="formal.object">
392
+ <xsl:with-param name="placement" select="$placement"/>
393
+ </xsl:call-template>
394
+
395
+ </xsl:template>
396
+
397
+ <xsl:template match="d:figure/d:title"/>
398
+ <xsl:template match="d:figure/d:titleabbrev"/>
399
+ <xsl:template match="d:table/d:title"/>
400
+ <xsl:template match="d:table/d:titleabbrev"/>
401
+ <xsl:template match="d:table/d:textobject"/>
402
+ <xsl:template match="d:example/d:title"/>
403
+ <xsl:template match="d:example/d:titleabbrev"/>
404
+ <xsl:template match="d:equation/d:title"/>
405
+ <xsl:template match="d:equation/d:titleabbrev"/>
406
+
407
+ <xsl:template match="d:informalfigure">
408
+ <xsl:call-template name="informal.object"/>
409
+ </xsl:template>
410
+
411
+ <xsl:template match="d:informalexample">
412
+ <xsl:call-template name="informal.object"/>
413
+ </xsl:template>
414
+
415
+ <xsl:template match="d:informaltable">
416
+ <xsl:choose>
417
+ <xsl:when test="d:tgroup|d:mediaobject|d:graphic">
418
+ <xsl:call-template name="informal.object"/>
419
+ </xsl:when>
420
+ <xsl:otherwise>
421
+ <div>
422
+ <xsl:call-template name="generate.class.attribute"/>
423
+ <xsl:call-template name="id.attribute"/>
424
+ <xsl:call-template name="anchor"/>
425
+ <xsl:element name="table" namespace="http://www.w3.org/1999/xhtml">
426
+ <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
427
+ <xsl:call-template name="htmlTable"/>
428
+ </xsl:element>
429
+ </div>
430
+ </xsl:otherwise>
431
+ </xsl:choose>
432
+ </xsl:template>
433
+
434
+ <xsl:template match="d:informaltable/d:textobject"/>
435
+
436
+ <xsl:template name="table.longdesc">
437
+ <!-- HACK: This doesn't belong inside formal.objectt; it should be done by -->
438
+ <!-- the table template, but I want the link to be inside the DIV, so... -->
439
+ <xsl:variable name="longdesc.uri">
440
+ <xsl:call-template name="longdesc.uri">
441
+ <xsl:with-param name="mediaobject" select="."/>
442
+ </xsl:call-template>
443
+ </xsl:variable>
444
+
445
+ <xsl:variable name="irrelevant">
446
+ <!-- write.longdesc returns the filename ... -->
447
+ <xsl:call-template name="write.longdesc">
448
+ <xsl:with-param name="mediaobject" select="."/>
449
+ </xsl:call-template>
450
+ </xsl:variable>
451
+
452
+ <xsl:if test="$html.longdesc != 0 and $html.longdesc.link != 0 and d:textobject[not(d:phrase)]">
453
+ <xsl:call-template name="longdesc.link">
454
+ <xsl:with-param name="longdesc.uri" select="$longdesc.uri"/>
455
+ </xsl:call-template>
456
+ </xsl:if>
457
+ </xsl:template>
458
+
459
+ <xsl:template match="d:informalequation">
460
+ <xsl:call-template name="informal.object"/>
461
+ </xsl:template>
462
+
463
+ <xsl:template name="floatstyle">
464
+ <xsl:if test="(@float and @float != '0') or @floatstyle != ''">
465
+ <xsl:choose>
466
+ <xsl:when test="@floatstyle != ''">
467
+ <xsl:value-of select="@floatstyle"/>
468
+ </xsl:when>
469
+ <xsl:when test="@float = '1'">
470
+ <xsl:value-of select="$default.float.class"/>
471
+ </xsl:when>
472
+ <xsl:otherwise>
473
+ <xsl:value-of select="@float"/>
474
+ </xsl:otherwise>
475
+ </xsl:choose>
476
+ </xsl:if>
477
+ </xsl:template>
478
+
479
+ <xsl:template name="floater">
480
+ <xsl:param name="content"/>
481
+ <xsl:param name="class" select="'float'"/>
482
+ <xsl:param name="floatstyle" select="'left'"/>
483
+
484
+ <div class="{$class}">
485
+ <xsl:if test="$floatstyle = 'left' or $floatstyle = 'right'">
486
+ <xsl:attribute name="style">
487
+ <xsl:text>float: </xsl:text>
488
+ <xsl:value-of select="$floatstyle"/>
489
+ <xsl:text>;</xsl:text>
490
+ </xsl:attribute>
491
+ </xsl:if>
492
+ <xsl:copy-of select="$content"/>
493
+ </div>
494
+ </xsl:template>
495
+
496
+ </xsl:stylesheet>