docbook_xsl_wrapper 0.1.2 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- 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,933 @@
|
|
1
|
+
<?xml version='1.0'?>
|
2
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
3
|
+
xmlns:d="http://docbook.org/ns/docbook"
|
4
|
+
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
|
5
|
+
exclude-result-prefixes="doc d"
|
6
|
+
version='1.0'>
|
7
|
+
|
8
|
+
<!-- ********************************************************************
|
9
|
+
$Id: labels.xsl 9816 2013-09-24 03:35:07Z stilor $
|
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
|
+
<!-- ==================================================================== -->
|
19
|
+
|
20
|
+
<!-- label markup -->
|
21
|
+
|
22
|
+
<doc:mode mode="label.markup" xmlns="">
|
23
|
+
<refpurpose>Provides access to element labels</refpurpose>
|
24
|
+
<refdescription id="label.markup-desc">
|
25
|
+
<para>Processing an element in the
|
26
|
+
<literal role="mode">label.markup</literal> mode produces the
|
27
|
+
element label.</para>
|
28
|
+
<para>Trailing punctuation is not added to the label.
|
29
|
+
</para>
|
30
|
+
</refdescription>
|
31
|
+
</doc:mode>
|
32
|
+
|
33
|
+
<!--
|
34
|
+
Note that this template is applied to parent of the object being
|
35
|
+
referenced, and that object is passed via parameter.
|
36
|
+
-->
|
37
|
+
<xsl:template match="*" mode="intralabel.punctuation">
|
38
|
+
<xsl:param name="object" select="."/>
|
39
|
+
|
40
|
+
<xsl:text>.</xsl:text>
|
41
|
+
</xsl:template>
|
42
|
+
|
43
|
+
<xsl:template match="*" mode="label.markup">
|
44
|
+
<xsl:param name="verbose" select="1"/>
|
45
|
+
<xsl:if test="$verbose">
|
46
|
+
<xsl:message>
|
47
|
+
<xsl:text>Request for label of unexpected element: </xsl:text>
|
48
|
+
<xsl:value-of select="local-name(.)"/>
|
49
|
+
</xsl:message>
|
50
|
+
</xsl:if>
|
51
|
+
</xsl:template>
|
52
|
+
|
53
|
+
<xsl:template match="d:set|d:book" mode="label.markup">
|
54
|
+
<xsl:if test="@label">
|
55
|
+
<xsl:value-of select="@label"/>
|
56
|
+
</xsl:if>
|
57
|
+
</xsl:template>
|
58
|
+
|
59
|
+
<xsl:template match="d:part" mode="label.markup">
|
60
|
+
<xsl:choose>
|
61
|
+
<xsl:when test="@label">
|
62
|
+
<xsl:value-of select="@label"/>
|
63
|
+
</xsl:when>
|
64
|
+
<xsl:when test="string($part.autolabel) != 0">
|
65
|
+
<xsl:variable name="format">
|
66
|
+
<xsl:call-template name="autolabel.format">
|
67
|
+
<xsl:with-param name="format" select="$part.autolabel"/>
|
68
|
+
</xsl:call-template>
|
69
|
+
</xsl:variable>
|
70
|
+
<xsl:number from="d:book" count="d:part" format="{$format}"/>
|
71
|
+
</xsl:when>
|
72
|
+
</xsl:choose>
|
73
|
+
</xsl:template>
|
74
|
+
|
75
|
+
<xsl:template match="d:partintro" mode="label.markup">
|
76
|
+
<!-- no label -->
|
77
|
+
</xsl:template>
|
78
|
+
|
79
|
+
<xsl:template match="d:preface" mode="label.markup">
|
80
|
+
<xsl:choose>
|
81
|
+
<xsl:when test="@label">
|
82
|
+
<xsl:value-of select="@label"/>
|
83
|
+
</xsl:when>
|
84
|
+
<xsl:when test="string($preface.autolabel) != 0">
|
85
|
+
<xsl:if test="$component.label.includes.part.label != 0 and
|
86
|
+
ancestor::d:part">
|
87
|
+
<xsl:variable name="part.label">
|
88
|
+
<xsl:apply-templates select="ancestor::d:part"
|
89
|
+
mode="label.markup"/>
|
90
|
+
</xsl:variable>
|
91
|
+
<xsl:if test="$part.label != ''">
|
92
|
+
<xsl:value-of select="$part.label"/>
|
93
|
+
<xsl:apply-templates select="ancestor::d:part"
|
94
|
+
mode="intralabel.punctuation">
|
95
|
+
<xsl:with-param name="object" select="."/>
|
96
|
+
</xsl:apply-templates>
|
97
|
+
</xsl:if>
|
98
|
+
</xsl:if>
|
99
|
+
<xsl:variable name="format">
|
100
|
+
<xsl:call-template name="autolabel.format">
|
101
|
+
<xsl:with-param name="format" select="$preface.autolabel"/>
|
102
|
+
</xsl:call-template>
|
103
|
+
</xsl:variable>
|
104
|
+
<xsl:choose>
|
105
|
+
<xsl:when test="$label.from.part != 0 and ancestor::d:part">
|
106
|
+
<xsl:number from="d:part" count="d:preface" format="{$format}" level="any"/>
|
107
|
+
</xsl:when>
|
108
|
+
<xsl:otherwise>
|
109
|
+
<xsl:number from="d:book" count="d:preface" format="{$format}" level="any"/>
|
110
|
+
</xsl:otherwise>
|
111
|
+
</xsl:choose>
|
112
|
+
</xsl:when>
|
113
|
+
</xsl:choose>
|
114
|
+
</xsl:template>
|
115
|
+
|
116
|
+
<xsl:template match="d:chapter" mode="label.markup">
|
117
|
+
<xsl:choose>
|
118
|
+
<xsl:when test="@label">
|
119
|
+
<xsl:value-of select="@label"/>
|
120
|
+
</xsl:when>
|
121
|
+
<xsl:when test="string($chapter.autolabel) != 0">
|
122
|
+
<xsl:if test="$component.label.includes.part.label != 0 and
|
123
|
+
ancestor::d:part">
|
124
|
+
<xsl:variable name="part.label">
|
125
|
+
<xsl:apply-templates select="ancestor::d:part"
|
126
|
+
mode="label.markup"/>
|
127
|
+
</xsl:variable>
|
128
|
+
<xsl:if test="$part.label != ''">
|
129
|
+
<xsl:value-of select="$part.label"/>
|
130
|
+
<xsl:apply-templates select="ancestor::d:part"
|
131
|
+
mode="intralabel.punctuation">
|
132
|
+
<xsl:with-param name="object" select="."/>
|
133
|
+
</xsl:apply-templates>
|
134
|
+
</xsl:if>
|
135
|
+
</xsl:if>
|
136
|
+
<xsl:variable name="format">
|
137
|
+
<xsl:call-template name="autolabel.format">
|
138
|
+
<xsl:with-param name="format" select="$chapter.autolabel"/>
|
139
|
+
</xsl:call-template>
|
140
|
+
</xsl:variable>
|
141
|
+
<xsl:choose>
|
142
|
+
<xsl:when test="$label.from.part != 0 and ancestor::d:part">
|
143
|
+
<xsl:number from="d:part" count="d:chapter" format="{$format}" level="any"/>
|
144
|
+
</xsl:when>
|
145
|
+
<xsl:otherwise>
|
146
|
+
<xsl:number from="d:book" count="d:chapter" format="{$format}" level="any"/>
|
147
|
+
</xsl:otherwise>
|
148
|
+
</xsl:choose>
|
149
|
+
</xsl:when>
|
150
|
+
</xsl:choose>
|
151
|
+
</xsl:template>
|
152
|
+
|
153
|
+
<xsl:template match="d:appendix" mode="label.markup">
|
154
|
+
<xsl:choose>
|
155
|
+
<xsl:when test="@label">
|
156
|
+
<xsl:value-of select="@label"/>
|
157
|
+
</xsl:when>
|
158
|
+
<xsl:when test="string($appendix.autolabel) != 0">
|
159
|
+
<xsl:if test="$component.label.includes.part.label != 0 and
|
160
|
+
ancestor::d:part">
|
161
|
+
<xsl:variable name="part.label">
|
162
|
+
<xsl:apply-templates select="ancestor::d:part"
|
163
|
+
mode="label.markup"/>
|
164
|
+
</xsl:variable>
|
165
|
+
<xsl:if test="$part.label != ''">
|
166
|
+
<xsl:value-of select="$part.label"/>
|
167
|
+
<xsl:apply-templates select="ancestor::d:part"
|
168
|
+
mode="intralabel.punctuation">
|
169
|
+
<xsl:with-param name="object" select="."/>
|
170
|
+
</xsl:apply-templates>
|
171
|
+
</xsl:if>
|
172
|
+
</xsl:if>
|
173
|
+
<xsl:variable name="format">
|
174
|
+
<xsl:call-template name="autolabel.format">
|
175
|
+
<xsl:with-param name="format" select="$appendix.autolabel"/>
|
176
|
+
</xsl:call-template>
|
177
|
+
</xsl:variable>
|
178
|
+
<xsl:choose>
|
179
|
+
<xsl:when test="$label.from.part != 0 and ancestor::d:part">
|
180
|
+
<xsl:number from="d:part" count="d:appendix" format="{$format}" level="any"/>
|
181
|
+
</xsl:when>
|
182
|
+
<xsl:otherwise>
|
183
|
+
<xsl:number from="d:book|d:article"
|
184
|
+
count="d:appendix" format="{$format}" level="any"/>
|
185
|
+
</xsl:otherwise>
|
186
|
+
</xsl:choose>
|
187
|
+
</xsl:when>
|
188
|
+
</xsl:choose>
|
189
|
+
</xsl:template>
|
190
|
+
|
191
|
+
<xsl:template match="d:article" mode="label.markup">
|
192
|
+
<xsl:if test="@label">
|
193
|
+
<xsl:value-of select="@label"/>
|
194
|
+
</xsl:if>
|
195
|
+
</xsl:template>
|
196
|
+
|
197
|
+
<xsl:template match="d:dedication|d:colophon" mode="label.markup">
|
198
|
+
<xsl:if test="@label">
|
199
|
+
<xsl:value-of select="@label"/>
|
200
|
+
</xsl:if>
|
201
|
+
</xsl:template>
|
202
|
+
|
203
|
+
<xsl:template match="d:reference" mode="label.markup">
|
204
|
+
<xsl:choose>
|
205
|
+
<xsl:when test="@label">
|
206
|
+
<xsl:value-of select="@label"/>
|
207
|
+
</xsl:when>
|
208
|
+
<xsl:when test="string($reference.autolabel) != 0">
|
209
|
+
<xsl:if test="$component.label.includes.part.label != 0 and
|
210
|
+
ancestor::d:part">
|
211
|
+
<xsl:variable name="part.label">
|
212
|
+
<xsl:apply-templates select="ancestor::d:part"
|
213
|
+
mode="label.markup"/>
|
214
|
+
</xsl:variable>
|
215
|
+
<xsl:if test="$part.label != ''">
|
216
|
+
<xsl:value-of select="$part.label"/>
|
217
|
+
<xsl:apply-templates select="ancestor::d:part"
|
218
|
+
mode="intralabel.punctuation">
|
219
|
+
<xsl:with-param name="object" select="."/>
|
220
|
+
</xsl:apply-templates>
|
221
|
+
</xsl:if>
|
222
|
+
</xsl:if>
|
223
|
+
<xsl:variable name="format">
|
224
|
+
<xsl:call-template name="autolabel.format">
|
225
|
+
<xsl:with-param name="format" select="$reference.autolabel"/>
|
226
|
+
</xsl:call-template>
|
227
|
+
</xsl:variable>
|
228
|
+
<xsl:choose>
|
229
|
+
<xsl:when test="$label.from.part != 0 and ancestor::d:part">
|
230
|
+
<xsl:number from="d:part" count="d:reference" format="{$format}" level="any"/>
|
231
|
+
</xsl:when>
|
232
|
+
<xsl:otherwise>
|
233
|
+
<xsl:number from="d:book" count="d:reference" format="{$format}" level="any"/>
|
234
|
+
</xsl:otherwise>
|
235
|
+
</xsl:choose>
|
236
|
+
</xsl:when>
|
237
|
+
</xsl:choose>
|
238
|
+
</xsl:template>
|
239
|
+
|
240
|
+
<xsl:template match="d:refentry" mode="label.markup">
|
241
|
+
<xsl:if test="@label">
|
242
|
+
<xsl:value-of select="@label"/>
|
243
|
+
</xsl:if>
|
244
|
+
</xsl:template>
|
245
|
+
|
246
|
+
<xsl:template match="d:section" mode="label.markup">
|
247
|
+
<!-- if this is a nested section, label the parent -->
|
248
|
+
<xsl:if test="local-name(..) = 'section'">
|
249
|
+
<xsl:variable name="parent.section.label">
|
250
|
+
<xsl:call-template name="label.this.section">
|
251
|
+
<xsl:with-param name="section" select=".."/>
|
252
|
+
</xsl:call-template>
|
253
|
+
</xsl:variable>
|
254
|
+
<xsl:if test="$parent.section.label != '0'">
|
255
|
+
<xsl:apply-templates select=".." mode="label.markup"/>
|
256
|
+
<xsl:apply-templates select=".." mode="intralabel.punctuation">
|
257
|
+
<xsl:with-param name="object" select="."/>
|
258
|
+
</xsl:apply-templates>
|
259
|
+
</xsl:if>
|
260
|
+
</xsl:if>
|
261
|
+
|
262
|
+
<!-- if the parent is a component, maybe label that too -->
|
263
|
+
<xsl:variable name="parent.is.component">
|
264
|
+
<xsl:call-template name="is.component">
|
265
|
+
<xsl:with-param name="node" select=".."/>
|
266
|
+
</xsl:call-template>
|
267
|
+
</xsl:variable>
|
268
|
+
|
269
|
+
<!-- does this section get labelled? -->
|
270
|
+
<xsl:variable name="label">
|
271
|
+
<xsl:call-template name="label.this.section">
|
272
|
+
<xsl:with-param name="section" select="."/>
|
273
|
+
</xsl:call-template>
|
274
|
+
</xsl:variable>
|
275
|
+
|
276
|
+
<xsl:if test="$section.label.includes.component.label != 0
|
277
|
+
and $parent.is.component != 0">
|
278
|
+
<xsl:variable name="parent.label">
|
279
|
+
<xsl:apply-templates select=".." mode="label.markup"/>
|
280
|
+
</xsl:variable>
|
281
|
+
<xsl:if test="$parent.label != ''">
|
282
|
+
<xsl:apply-templates select=".." mode="label.markup"/>
|
283
|
+
<xsl:apply-templates select=".." mode="intralabel.punctuation">
|
284
|
+
<xsl:with-param name="object" select="."/>
|
285
|
+
</xsl:apply-templates>
|
286
|
+
</xsl:if>
|
287
|
+
</xsl:if>
|
288
|
+
|
289
|
+
<!--
|
290
|
+
<xsl:message>
|
291
|
+
test: <xsl:value-of select="$label"/>, <xsl:number count="d:section"/>
|
292
|
+
</xsl:message>
|
293
|
+
-->
|
294
|
+
|
295
|
+
<xsl:choose>
|
296
|
+
<xsl:when test="@label">
|
297
|
+
<xsl:value-of select="@label"/>
|
298
|
+
</xsl:when>
|
299
|
+
<xsl:when test="$label != 0">
|
300
|
+
<xsl:variable name="format">
|
301
|
+
<xsl:call-template name="autolabel.format">
|
302
|
+
<xsl:with-param name="format" select="$section.autolabel"/>
|
303
|
+
</xsl:call-template>
|
304
|
+
</xsl:variable>
|
305
|
+
<xsl:number format="{$format}" count="d:section"/>
|
306
|
+
</xsl:when>
|
307
|
+
</xsl:choose>
|
308
|
+
</xsl:template>
|
309
|
+
|
310
|
+
<xsl:template match="d:sect1" mode="label.markup">
|
311
|
+
<!-- if the parent is a component, maybe label that too -->
|
312
|
+
<xsl:variable name="parent.is.component">
|
313
|
+
<xsl:call-template name="is.component">
|
314
|
+
<xsl:with-param name="node" select=".."/>
|
315
|
+
</xsl:call-template>
|
316
|
+
</xsl:variable>
|
317
|
+
|
318
|
+
<xsl:variable name="component.label">
|
319
|
+
<xsl:if test="$section.label.includes.component.label != 0
|
320
|
+
and $parent.is.component != 0">
|
321
|
+
<xsl:variable name="parent.label">
|
322
|
+
<xsl:apply-templates select=".." mode="label.markup"/>
|
323
|
+
</xsl:variable>
|
324
|
+
<xsl:if test="$parent.label != ''">
|
325
|
+
<xsl:apply-templates select=".." mode="label.markup"/>
|
326
|
+
<xsl:apply-templates select=".." mode="intralabel.punctuation">
|
327
|
+
<xsl:with-param name="object" select="."/>
|
328
|
+
</xsl:apply-templates>
|
329
|
+
</xsl:if>
|
330
|
+
</xsl:if>
|
331
|
+
</xsl:variable>
|
332
|
+
|
333
|
+
|
334
|
+
<xsl:variable name="is.numbered">
|
335
|
+
<xsl:call-template name="label.this.section"/>
|
336
|
+
</xsl:variable>
|
337
|
+
|
338
|
+
<xsl:choose>
|
339
|
+
<xsl:when test="@label">
|
340
|
+
<xsl:value-of select="@label"/>
|
341
|
+
</xsl:when>
|
342
|
+
<xsl:when test="$is.numbered != 0">
|
343
|
+
<xsl:variable name="format">
|
344
|
+
<xsl:call-template name="autolabel.format">
|
345
|
+
<xsl:with-param name="format" select="$section.autolabel"/>
|
346
|
+
</xsl:call-template>
|
347
|
+
</xsl:variable>
|
348
|
+
<xsl:copy-of select="$component.label"/>
|
349
|
+
<xsl:number format="{$format}" count="d:sect1"/>
|
350
|
+
</xsl:when>
|
351
|
+
</xsl:choose>
|
352
|
+
</xsl:template>
|
353
|
+
|
354
|
+
<xsl:template match="d:sect2|d:sect3|d:sect4|d:sect5" mode="label.markup">
|
355
|
+
<!-- label the parent -->
|
356
|
+
<xsl:variable name="parent.section.label">
|
357
|
+
<xsl:call-template name="label.this.section">
|
358
|
+
<xsl:with-param name="section" select=".."/>
|
359
|
+
</xsl:call-template>
|
360
|
+
</xsl:variable>
|
361
|
+
<xsl:if test="$parent.section.label != '0'">
|
362
|
+
<xsl:apply-templates select=".." mode="label.markup"/>
|
363
|
+
<xsl:apply-templates select=".." mode="intralabel.punctuation">
|
364
|
+
<xsl:with-param name="object" select="."/>
|
365
|
+
</xsl:apply-templates>
|
366
|
+
</xsl:if>
|
367
|
+
|
368
|
+
<xsl:variable name="is.numbered">
|
369
|
+
<xsl:call-template name="label.this.section"/>
|
370
|
+
</xsl:variable>
|
371
|
+
|
372
|
+
<xsl:choose>
|
373
|
+
<xsl:when test="@label">
|
374
|
+
<xsl:value-of select="@label"/>
|
375
|
+
</xsl:when>
|
376
|
+
<xsl:when test="$is.numbered != 0">
|
377
|
+
<xsl:variable name="format">
|
378
|
+
<xsl:call-template name="autolabel.format">
|
379
|
+
<xsl:with-param name="format" select="$section.autolabel"/>
|
380
|
+
</xsl:call-template>
|
381
|
+
</xsl:variable>
|
382
|
+
<xsl:choose>
|
383
|
+
<xsl:when test="local-name(.) = 'sect2'">
|
384
|
+
<xsl:number format="{$format}" count="d:sect2"/>
|
385
|
+
</xsl:when>
|
386
|
+
<xsl:when test="local-name(.) = 'sect3'">
|
387
|
+
<xsl:number format="{$format}" count="d:sect3"/>
|
388
|
+
</xsl:when>
|
389
|
+
<xsl:when test="local-name(.) = 'sect4'">
|
390
|
+
<xsl:number format="{$format}" count="d:sect4"/>
|
391
|
+
</xsl:when>
|
392
|
+
<xsl:when test="local-name(.) = 'sect5'">
|
393
|
+
<xsl:number format="{$format}" count="d:sect5"/>
|
394
|
+
</xsl:when>
|
395
|
+
<xsl:otherwise>
|
396
|
+
<xsl:message>label.markup: this can't happen!</xsl:message>
|
397
|
+
</xsl:otherwise>
|
398
|
+
</xsl:choose>
|
399
|
+
</xsl:when>
|
400
|
+
</xsl:choose>
|
401
|
+
</xsl:template>
|
402
|
+
|
403
|
+
<xsl:template match="d:bridgehead" mode="label.markup">
|
404
|
+
<!-- bridgeheads are not normally numbered -->
|
405
|
+
</xsl:template>
|
406
|
+
|
407
|
+
<xsl:template match="d:refsect1" mode="label.markup">
|
408
|
+
<xsl:choose>
|
409
|
+
<xsl:when test="@label">
|
410
|
+
<xsl:value-of select="@label"/>
|
411
|
+
</xsl:when>
|
412
|
+
<xsl:when test="$section.autolabel != 0">
|
413
|
+
<xsl:variable name="format">
|
414
|
+
<xsl:call-template name="autolabel.format">
|
415
|
+
<xsl:with-param name="format" select="$section.autolabel"/>
|
416
|
+
</xsl:call-template>
|
417
|
+
</xsl:variable>
|
418
|
+
<xsl:number count="d:refsect1" format="{$format}"/>
|
419
|
+
</xsl:when>
|
420
|
+
</xsl:choose>
|
421
|
+
</xsl:template>
|
422
|
+
|
423
|
+
<xsl:template match="d:refsect2|d:refsect3" mode="label.markup">
|
424
|
+
<!-- label the parent -->
|
425
|
+
<xsl:variable name="parent.label">
|
426
|
+
<xsl:apply-templates select=".." mode="label.markup"/>
|
427
|
+
</xsl:variable>
|
428
|
+
<xsl:if test="$parent.label != ''">
|
429
|
+
<xsl:apply-templates select=".." mode="label.markup"/>
|
430
|
+
<xsl:apply-templates select=".." mode="intralabel.punctuation">
|
431
|
+
<xsl:with-param name="object" select="."/>
|
432
|
+
</xsl:apply-templates>
|
433
|
+
</xsl:if>
|
434
|
+
|
435
|
+
<xsl:choose>
|
436
|
+
<xsl:when test="@label">
|
437
|
+
<xsl:value-of select="@label"/>
|
438
|
+
</xsl:when>
|
439
|
+
<xsl:when test="$section.autolabel != 0">
|
440
|
+
<xsl:variable name="format">
|
441
|
+
<xsl:call-template name="autolabel.format">
|
442
|
+
<xsl:with-param name="format" select="$section.autolabel"/>
|
443
|
+
</xsl:call-template>
|
444
|
+
</xsl:variable>
|
445
|
+
<xsl:choose>
|
446
|
+
<xsl:when test="local-name(.) = 'refsect2'">
|
447
|
+
<xsl:number count="d:refsect2" format="{$format}"/>
|
448
|
+
</xsl:when>
|
449
|
+
<xsl:otherwise>
|
450
|
+
<xsl:number count="d:refsect3" format="{$format}"/>
|
451
|
+
</xsl:otherwise>
|
452
|
+
</xsl:choose>
|
453
|
+
</xsl:when>
|
454
|
+
</xsl:choose>
|
455
|
+
</xsl:template>
|
456
|
+
|
457
|
+
<xsl:template match="d:simplesect" mode="label.markup">
|
458
|
+
<!-- if this is a nested section, label the parent -->
|
459
|
+
<xsl:if test="local-name(..) = 'section'
|
460
|
+
or local-name(..) = 'sect1'
|
461
|
+
or local-name(..) = 'sect2'
|
462
|
+
or local-name(..) = 'sect3'
|
463
|
+
or local-name(..) = 'sect4'
|
464
|
+
or local-name(..) = 'sect5'">
|
465
|
+
<xsl:variable name="parent.section.label">
|
466
|
+
<xsl:apply-templates select=".." mode="label.markup"/>
|
467
|
+
</xsl:variable>
|
468
|
+
<xsl:if test="$parent.section.label != ''">
|
469
|
+
<xsl:apply-templates select=".." mode="label.markup"/>
|
470
|
+
<xsl:apply-templates select=".." mode="intralabel.punctuation">
|
471
|
+
<xsl:with-param name="object" select="."/>
|
472
|
+
</xsl:apply-templates>
|
473
|
+
</xsl:if>
|
474
|
+
</xsl:if>
|
475
|
+
|
476
|
+
<!-- if the parent is a component, maybe label that too -->
|
477
|
+
<xsl:variable name="parent.is.component">
|
478
|
+
<xsl:call-template name="is.component">
|
479
|
+
<xsl:with-param name="node" select=".."/>
|
480
|
+
</xsl:call-template>
|
481
|
+
</xsl:variable>
|
482
|
+
|
483
|
+
<!-- does this section get labelled? -->
|
484
|
+
<xsl:variable name="label">
|
485
|
+
<xsl:call-template name="label.this.section">
|
486
|
+
<xsl:with-param name="section" select="."/>
|
487
|
+
</xsl:call-template>
|
488
|
+
</xsl:variable>
|
489
|
+
|
490
|
+
<xsl:if test="$section.label.includes.component.label != 0
|
491
|
+
and $parent.is.component != 0">
|
492
|
+
<xsl:variable name="parent.label">
|
493
|
+
<xsl:apply-templates select=".." mode="label.markup"/>
|
494
|
+
</xsl:variable>
|
495
|
+
<xsl:if test="$parent.label != ''">
|
496
|
+
<xsl:apply-templates select=".." mode="label.markup"/>
|
497
|
+
<xsl:apply-templates select=".." mode="intralabel.punctuation">
|
498
|
+
<xsl:with-param name="object" select="."/>
|
499
|
+
</xsl:apply-templates>
|
500
|
+
</xsl:if>
|
501
|
+
</xsl:if>
|
502
|
+
|
503
|
+
<xsl:choose>
|
504
|
+
<xsl:when test="@label">
|
505
|
+
<xsl:value-of select="@label"/>
|
506
|
+
</xsl:when>
|
507
|
+
<xsl:when test="$label != 0">
|
508
|
+
<xsl:variable name="format">
|
509
|
+
<xsl:call-template name="autolabel.format">
|
510
|
+
<xsl:with-param name="format" select="$section.autolabel"/>
|
511
|
+
</xsl:call-template>
|
512
|
+
</xsl:variable>
|
513
|
+
<xsl:number format="{$format}" count="d:simplesect"/>
|
514
|
+
</xsl:when>
|
515
|
+
</xsl:choose>
|
516
|
+
</xsl:template>
|
517
|
+
|
518
|
+
<xsl:template match="d:topic" mode="label.markup">
|
519
|
+
<!-- topics are not numbered by default -->
|
520
|
+
</xsl:template>
|
521
|
+
|
522
|
+
<xsl:template match="d:qandadiv" mode="label.markup">
|
523
|
+
<xsl:variable name="lparent" select="(ancestor::d:set
|
524
|
+
|ancestor::d:book
|
525
|
+
|ancestor::d:chapter
|
526
|
+
|ancestor::d:appendix
|
527
|
+
|ancestor::d:preface
|
528
|
+
|ancestor::d:section
|
529
|
+
|ancestor::d:simplesect
|
530
|
+
|ancestor::d:sect1
|
531
|
+
|ancestor::d:sect2
|
532
|
+
|ancestor::d:sect3
|
533
|
+
|ancestor::d:sect4
|
534
|
+
|ancestor::d:sect5
|
535
|
+
|ancestor::d:refsect1
|
536
|
+
|ancestor::d:refsect2
|
537
|
+
|ancestor::d:refsect3)[last()]"/>
|
538
|
+
|
539
|
+
<xsl:variable name="lparent.prefix">
|
540
|
+
<xsl:apply-templates select="$lparent" mode="label.markup"/>
|
541
|
+
</xsl:variable>
|
542
|
+
|
543
|
+
<xsl:variable name="prefix">
|
544
|
+
<xsl:if test="$qanda.inherit.numeration != 0">
|
545
|
+
<xsl:if test="$lparent.prefix != ''">
|
546
|
+
<xsl:apply-templates select="$lparent" mode="label.markup"/>
|
547
|
+
<xsl:apply-templates select="$lparent" mode="intralabel.punctuation">
|
548
|
+
<xsl:with-param name="object" select="."/>
|
549
|
+
</xsl:apply-templates>
|
550
|
+
</xsl:if>
|
551
|
+
</xsl:if>
|
552
|
+
</xsl:variable>
|
553
|
+
|
554
|
+
<xsl:choose>
|
555
|
+
<xsl:when test="$qandadiv.autolabel != 0">
|
556
|
+
<xsl:variable name="format">
|
557
|
+
<xsl:call-template name="autolabel.format">
|
558
|
+
<xsl:with-param name="format" select="$qandadiv.autolabel"/>
|
559
|
+
</xsl:call-template>
|
560
|
+
</xsl:variable>
|
561
|
+
<xsl:value-of select="$prefix"/>
|
562
|
+
<xsl:number level="multiple" count="d:qandadiv" format="{$format}"/>
|
563
|
+
</xsl:when>
|
564
|
+
</xsl:choose>
|
565
|
+
</xsl:template>
|
566
|
+
|
567
|
+
<xsl:template match="d:question|d:answer" mode="label.markup">
|
568
|
+
<xsl:variable name="lparent" select="(ancestor::d:set
|
569
|
+
|ancestor::d:book
|
570
|
+
|ancestor::d:chapter
|
571
|
+
|ancestor::d:appendix
|
572
|
+
|ancestor::d:preface
|
573
|
+
|ancestor::d:section
|
574
|
+
|ancestor::d:simplesect
|
575
|
+
|ancestor::d:sect1
|
576
|
+
|ancestor::d:sect2
|
577
|
+
|ancestor::d:sect3
|
578
|
+
|ancestor::d:sect4
|
579
|
+
|ancestor::d:sect5
|
580
|
+
|ancestor::d:refsect1
|
581
|
+
|ancestor::d:refsect2
|
582
|
+
|ancestor::d:refsect3)[last()]"/>
|
583
|
+
|
584
|
+
<xsl:variable name="lparent.prefix">
|
585
|
+
<xsl:apply-templates select="$lparent" mode="label.markup"/>
|
586
|
+
</xsl:variable>
|
587
|
+
|
588
|
+
<xsl:variable name="prefix">
|
589
|
+
<xsl:if test="$qanda.inherit.numeration != 0">
|
590
|
+
<xsl:choose>
|
591
|
+
<xsl:when test="ancestor::d:qandadiv">
|
592
|
+
<xsl:variable name="div.label">
|
593
|
+
<xsl:apply-templates select="ancestor::d:qandadiv[1]" mode="label.markup"/>
|
594
|
+
</xsl:variable>
|
595
|
+
<xsl:if test="string-length($div.label) != 0">
|
596
|
+
<xsl:copy-of select="$div.label"/>
|
597
|
+
<xsl:apply-templates select="ancestor::d:qandadiv[1]"
|
598
|
+
mode="intralabel.punctuation">
|
599
|
+
<xsl:with-param name="object" select="."/>
|
600
|
+
</xsl:apply-templates>
|
601
|
+
</xsl:if>
|
602
|
+
</xsl:when>
|
603
|
+
<xsl:when test="$lparent.prefix != ''">
|
604
|
+
<xsl:apply-templates select="$lparent" mode="label.markup"/>
|
605
|
+
<xsl:apply-templates select="$lparent" mode="intralabel.punctuation">
|
606
|
+
<xsl:with-param name="object" select="."/>
|
607
|
+
</xsl:apply-templates>
|
608
|
+
</xsl:when>
|
609
|
+
</xsl:choose>
|
610
|
+
</xsl:if>
|
611
|
+
</xsl:variable>
|
612
|
+
|
613
|
+
<xsl:variable name="inhlabel"
|
614
|
+
select="ancestor-or-self::d:qandaset/@defaultlabel[1]"/>
|
615
|
+
|
616
|
+
<xsl:variable name="deflabel">
|
617
|
+
<xsl:choose>
|
618
|
+
<xsl:when test="$inhlabel != ''">
|
619
|
+
<xsl:value-of select="$inhlabel"/>
|
620
|
+
</xsl:when>
|
621
|
+
<xsl:otherwise>
|
622
|
+
<xsl:value-of select="$qanda.defaultlabel"/>
|
623
|
+
</xsl:otherwise>
|
624
|
+
</xsl:choose>
|
625
|
+
</xsl:variable>
|
626
|
+
|
627
|
+
<xsl:variable name="label" select="d:label"/>
|
628
|
+
|
629
|
+
<xsl:choose>
|
630
|
+
<xsl:when test="count($label)>0">
|
631
|
+
<xsl:apply-templates select="$label"/>
|
632
|
+
</xsl:when>
|
633
|
+
|
634
|
+
<xsl:when test="$deflabel = 'qanda' and self::d:question">
|
635
|
+
<xsl:call-template name="gentext">
|
636
|
+
<xsl:with-param name="key" select="'Question'"/>
|
637
|
+
</xsl:call-template>
|
638
|
+
</xsl:when>
|
639
|
+
|
640
|
+
<xsl:when test="$deflabel = 'qanda' and self::d:answer">
|
641
|
+
<xsl:call-template name="gentext">
|
642
|
+
<xsl:with-param name="key" select="'Answer'"/>
|
643
|
+
</xsl:call-template>
|
644
|
+
</xsl:when>
|
645
|
+
|
646
|
+
<xsl:when test="($deflabel = 'qnumber' or
|
647
|
+
$deflabel = 'qnumberanda') and self::d:question">
|
648
|
+
<xsl:call-template name="gentext">
|
649
|
+
<xsl:with-param name="key" select="'Question'"/>
|
650
|
+
</xsl:call-template>
|
651
|
+
<xsl:text> </xsl:text>
|
652
|
+
<xsl:value-of select="$prefix"/>
|
653
|
+
<xsl:number level="multiple" count="d:qandaentry" format="1"/>
|
654
|
+
</xsl:when>
|
655
|
+
|
656
|
+
<xsl:when test="$deflabel = 'qnumberanda' and self::d:answer">
|
657
|
+
<xsl:call-template name="gentext">
|
658
|
+
<xsl:with-param name="key" select="'Answer'"/>
|
659
|
+
</xsl:call-template>
|
660
|
+
</xsl:when>
|
661
|
+
|
662
|
+
<xsl:when test="$deflabel = 'number' and self::d:question">
|
663
|
+
<xsl:value-of select="$prefix"/>
|
664
|
+
<xsl:number level="multiple" count="d:qandaentry" format="1"/>
|
665
|
+
</xsl:when>
|
666
|
+
</xsl:choose>
|
667
|
+
</xsl:template>
|
668
|
+
|
669
|
+
<xsl:template match="d:bibliography|d:glossary|
|
670
|
+
d:qandaset|d:index|d:setindex" mode="label.markup">
|
671
|
+
<xsl:if test="@label">
|
672
|
+
<xsl:value-of select="@label"/>
|
673
|
+
</xsl:if>
|
674
|
+
</xsl:template>
|
675
|
+
|
676
|
+
<xsl:template match="d:figure|d:table|d:example" mode="label.markup">
|
677
|
+
<xsl:variable name="pchap"
|
678
|
+
select="(ancestor::d:chapter
|
679
|
+
|ancestor::d:appendix
|
680
|
+
|ancestor::d:article[ancestor::d:book])[last()]"/>
|
681
|
+
|
682
|
+
<xsl:variable name="prefix">
|
683
|
+
<xsl:if test="count($pchap) > 0">
|
684
|
+
<xsl:apply-templates select="$pchap" mode="label.markup"/>
|
685
|
+
</xsl:if>
|
686
|
+
</xsl:variable>
|
687
|
+
|
688
|
+
<xsl:choose>
|
689
|
+
<xsl:when test="@label">
|
690
|
+
<xsl:value-of select="@label"/>
|
691
|
+
</xsl:when>
|
692
|
+
<xsl:otherwise>
|
693
|
+
<xsl:choose>
|
694
|
+
<xsl:when test="$prefix != ''">
|
695
|
+
<xsl:apply-templates select="$pchap" mode="label.markup"/>
|
696
|
+
<xsl:apply-templates select="$pchap" mode="intralabel.punctuation">
|
697
|
+
<xsl:with-param name="object" select="."/>
|
698
|
+
</xsl:apply-templates>
|
699
|
+
<xsl:number format="1" from="d:chapter|d:appendix" level="any"/>
|
700
|
+
</xsl:when>
|
701
|
+
<xsl:otherwise>
|
702
|
+
<xsl:number format="1" from="d:book|d:article" level="any"/>
|
703
|
+
</xsl:otherwise>
|
704
|
+
</xsl:choose>
|
705
|
+
</xsl:otherwise>
|
706
|
+
</xsl:choose>
|
707
|
+
</xsl:template>
|
708
|
+
|
709
|
+
<xsl:template match="d:procedure" mode="label.markup">
|
710
|
+
<xsl:variable name="pchap"
|
711
|
+
select="ancestor::d:chapter
|
712
|
+
|ancestor::d:appendix
|
713
|
+
|ancestor::d:article[ancestor::d:book]"/>
|
714
|
+
|
715
|
+
<xsl:variable name="prefix">
|
716
|
+
<xsl:if test="count($pchap) > 0">
|
717
|
+
<xsl:apply-templates select="$pchap" mode="label.markup"/>
|
718
|
+
</xsl:if>
|
719
|
+
</xsl:variable>
|
720
|
+
|
721
|
+
<xsl:choose>
|
722
|
+
<xsl:when test="@label">
|
723
|
+
<xsl:value-of select="@label"/>
|
724
|
+
</xsl:when>
|
725
|
+
<xsl:when test="$formal.procedures = 0">
|
726
|
+
<!-- No label -->
|
727
|
+
</xsl:when>
|
728
|
+
<xsl:otherwise>
|
729
|
+
<xsl:choose>
|
730
|
+
<xsl:when test="count($pchap)>0">
|
731
|
+
<xsl:if test="$prefix != ''">
|
732
|
+
<xsl:apply-templates select="$pchap" mode="label.markup"/>
|
733
|
+
<xsl:apply-templates select="$pchap" mode="intralabel.punctuation">
|
734
|
+
<xsl:with-param name="object" select="."/>
|
735
|
+
</xsl:apply-templates>
|
736
|
+
</xsl:if>
|
737
|
+
<xsl:number count="d:procedure[d:title|d:blockinfo/d:title|d:info/d:title]" format="1"
|
738
|
+
from="d:chapter|d:appendix" level="any"/>
|
739
|
+
</xsl:when>
|
740
|
+
<xsl:otherwise>
|
741
|
+
<xsl:number count="d:procedure[d:title|d:blockinfo/d:title|d:info/d:title]" format="1"
|
742
|
+
from="d:book|d:article" level="any"/>
|
743
|
+
</xsl:otherwise>
|
744
|
+
</xsl:choose>
|
745
|
+
</xsl:otherwise>
|
746
|
+
</xsl:choose>
|
747
|
+
</xsl:template>
|
748
|
+
|
749
|
+
<xsl:template match="d:equation" mode="label.markup">
|
750
|
+
<xsl:variable name="pchap"
|
751
|
+
select="ancestor::d:chapter
|
752
|
+
|ancestor::d:appendix
|
753
|
+
|ancestor::d:article[ancestor::d:book]"/>
|
754
|
+
|
755
|
+
<xsl:variable name="prefix">
|
756
|
+
<xsl:if test="count($pchap) > 0">
|
757
|
+
<xsl:apply-templates select="$pchap" mode="label.markup"/>
|
758
|
+
</xsl:if>
|
759
|
+
</xsl:variable>
|
760
|
+
|
761
|
+
<xsl:choose>
|
762
|
+
<xsl:when test="@label">
|
763
|
+
<xsl:value-of select="@label"/>
|
764
|
+
</xsl:when>
|
765
|
+
<xsl:otherwise>
|
766
|
+
<xsl:choose>
|
767
|
+
<xsl:when test="count($pchap)>0">
|
768
|
+
<xsl:if test="$prefix != ''">
|
769
|
+
<xsl:apply-templates select="$pchap" mode="label.markup"/>
|
770
|
+
<xsl:apply-templates select="$pchap" mode="intralabel.punctuation">
|
771
|
+
<xsl:with-param name="object" select="."/>
|
772
|
+
</xsl:apply-templates>
|
773
|
+
</xsl:if>
|
774
|
+
<xsl:number format="1" count="d:equation"
|
775
|
+
from="d:chapter|d:appendix" level="any"/>
|
776
|
+
</xsl:when>
|
777
|
+
<xsl:otherwise>
|
778
|
+
<xsl:number format="1" count="d:equation"
|
779
|
+
from="d:book|d:article" level="any"/>
|
780
|
+
</xsl:otherwise>
|
781
|
+
</xsl:choose>
|
782
|
+
</xsl:otherwise>
|
783
|
+
</xsl:choose>
|
784
|
+
</xsl:template>
|
785
|
+
|
786
|
+
<xsl:template match="d:orderedlist/d:listitem" mode="label.markup">
|
787
|
+
<xsl:variable name="numeration">
|
788
|
+
<xsl:call-template name="list.numeration">
|
789
|
+
<xsl:with-param name="node" select="parent::d:orderedlist"/>
|
790
|
+
</xsl:call-template>
|
791
|
+
</xsl:variable>
|
792
|
+
|
793
|
+
<xsl:variable name="type">
|
794
|
+
<xsl:choose>
|
795
|
+
<xsl:when test="$numeration='arabic'">1</xsl:when>
|
796
|
+
<xsl:when test="$numeration='loweralpha'">a</xsl:when>
|
797
|
+
<xsl:when test="$numeration='lowerroman'">i</xsl:when>
|
798
|
+
<xsl:when test="$numeration='upperalpha'">A</xsl:when>
|
799
|
+
<xsl:when test="$numeration='upperroman'">I</xsl:when>
|
800
|
+
<!-- What!? This should never happen -->
|
801
|
+
<xsl:otherwise>
|
802
|
+
<xsl:message>
|
803
|
+
<xsl:text>Unexpected numeration: </xsl:text>
|
804
|
+
<xsl:value-of select="$numeration"/>
|
805
|
+
</xsl:message>
|
806
|
+
<xsl:value-of select="1."/>
|
807
|
+
</xsl:otherwise>
|
808
|
+
</xsl:choose>
|
809
|
+
</xsl:variable>
|
810
|
+
|
811
|
+
<xsl:variable name="item-number">
|
812
|
+
<xsl:call-template name="orderedlist-item-number"/>
|
813
|
+
</xsl:variable>
|
814
|
+
|
815
|
+
<xsl:number value="$item-number" format="{$type}"/>
|
816
|
+
</xsl:template>
|
817
|
+
|
818
|
+
<xsl:template match="d:production" mode="label.markup">
|
819
|
+
<xsl:number count="d:production" level="any"/>
|
820
|
+
</xsl:template>
|
821
|
+
|
822
|
+
<xsl:template match="d:abstract" mode="label.markup">
|
823
|
+
<!-- nop -->
|
824
|
+
</xsl:template>
|
825
|
+
|
826
|
+
<xsl:template match="d:sidebar" mode="label.markup">
|
827
|
+
<!-- nop -->
|
828
|
+
</xsl:template>
|
829
|
+
|
830
|
+
<xsl:template match="d:glossdiv|d:glosslist" mode="label.markup">
|
831
|
+
<!-- nop -->
|
832
|
+
</xsl:template>
|
833
|
+
|
834
|
+
<xsl:template match="d:glossentry" mode="label.markup">
|
835
|
+
<!-- nop -->
|
836
|
+
</xsl:template>
|
837
|
+
|
838
|
+
<!-- ============================================================ -->
|
839
|
+
|
840
|
+
<xsl:template name="label.this.section">
|
841
|
+
<xsl:param name="section" select="."/>
|
842
|
+
|
843
|
+
<xsl:variable name="level">
|
844
|
+
<xsl:call-template name="section.level"/>
|
845
|
+
</xsl:variable>
|
846
|
+
|
847
|
+
<xsl:choose>
|
848
|
+
<!-- bridgeheads are not numbered -->
|
849
|
+
<xsl:when test="$section/self::d:bridgehead">0</xsl:when>
|
850
|
+
<xsl:when test="$level <= $section.autolabel.max.depth">
|
851
|
+
<xsl:value-of select="$section.autolabel"/>
|
852
|
+
</xsl:when>
|
853
|
+
<xsl:otherwise>0</xsl:otherwise>
|
854
|
+
</xsl:choose>
|
855
|
+
</xsl:template>
|
856
|
+
|
857
|
+
<doc:template name="label.this.section" xmlns="">
|
858
|
+
<refpurpose>Returns true if $section should be labelled</refpurpose>
|
859
|
+
<refdescription id="label.this.section-desc">
|
860
|
+
<para>Returns true if the specified section should be labelled.
|
861
|
+
By default, this template returns zero unless
|
862
|
+
the section level is less than or equal to the value of the
|
863
|
+
<literal>$section.autolabel.max.depth</literal> parameter, in
|
864
|
+
which case it returns
|
865
|
+
<literal>$section.autolabel</literal>.
|
866
|
+
Custom stylesheets may override it to get more selective behavior.</para>
|
867
|
+
</refdescription>
|
868
|
+
</doc:template>
|
869
|
+
|
870
|
+
<!-- ============================================================ -->
|
871
|
+
|
872
|
+
<xsl:template name="default.autolabel.format">
|
873
|
+
<xsl:param name="context" select="."/>
|
874
|
+
<xsl:choose>
|
875
|
+
<xsl:when test="local-name($context) = 'appendix'">
|
876
|
+
<xsl:value-of select="'A'"/>
|
877
|
+
</xsl:when>
|
878
|
+
<xsl:when test="local-name($context) = 'part'">
|
879
|
+
<xsl:value-of select="'I'"/>
|
880
|
+
</xsl:when>
|
881
|
+
<xsl:otherwise>1</xsl:otherwise>
|
882
|
+
</xsl:choose>
|
883
|
+
</xsl:template>
|
884
|
+
|
885
|
+
<xsl:template name="autolabel.format">
|
886
|
+
<xsl:param name="context" select="."/>
|
887
|
+
<xsl:param name="format"/>
|
888
|
+
|
889
|
+
<xsl:choose>
|
890
|
+
<xsl:when test="string($format) != 0">
|
891
|
+
<xsl:choose>
|
892
|
+
<xsl:when test="string($format)='arabic' or $format='1'">1</xsl:when>
|
893
|
+
<xsl:when test="$format='loweralpha' or $format='a'">
|
894
|
+
<xsl:value-of select="'a'"/>
|
895
|
+
</xsl:when>
|
896
|
+
<xsl:when test="$format='lowerroman' or $format='i'">
|
897
|
+
<xsl:value-of select="'i'"/>
|
898
|
+
</xsl:when>
|
899
|
+
<xsl:when test="$format='upperalpha' or $format='A'">
|
900
|
+
<xsl:value-of select="'A'"/>
|
901
|
+
</xsl:when>
|
902
|
+
<xsl:when test="$format='upperroman' or $format='I'">
|
903
|
+
<xsl:value-of select="'I'"/>
|
904
|
+
</xsl:when>
|
905
|
+
<xsl:when test="$format='arabicindic' or $format='١'">
|
906
|
+
<xsl:value-of select="'١'"/>
|
907
|
+
</xsl:when>
|
908
|
+
<xsl:otherwise>
|
909
|
+
<xsl:message>
|
910
|
+
<xsl:text>Unexpected </xsl:text><xsl:value-of select="local-name(.)"/><xsl:text>.autolabel value: </xsl:text>
|
911
|
+
<xsl:value-of select="$format"/><xsl:text>; using default.</xsl:text>
|
912
|
+
</xsl:message>
|
913
|
+
<xsl:call-template name="default.autolabel.format"/>
|
914
|
+
</xsl:otherwise>
|
915
|
+
</xsl:choose>
|
916
|
+
</xsl:when>
|
917
|
+
</xsl:choose>
|
918
|
+
</xsl:template>
|
919
|
+
|
920
|
+
<doc:template name="autolabel.format" xmlns="">
|
921
|
+
<refpurpose>Returns format for autolabel parameters</refpurpose>
|
922
|
+
<refdescription id="autolabel.format-desc">
|
923
|
+
<para>Returns format passed as parameter if non zero. Supported
|
924
|
+
format are 'arabic' or '1', 'loweralpha' or 'a', 'lowerroman' or 'i',
|
925
|
+
'upperlapha' or 'A', 'upperroman' or 'I', 'arabicindic' or '١'.
|
926
|
+
If its not one of these then
|
927
|
+
returns the default format.</para>
|
928
|
+
</refdescription>
|
929
|
+
</doc:template>
|
930
|
+
|
931
|
+
<!-- ============================================================ -->
|
932
|
+
|
933
|
+
</xsl:stylesheet>
|