1 |
26607
|
alessia.ba
|
<?xml version="1.0"?>
|
2 |
|
|
<!DOCTYPE xsl:stylesheet [
|
3 |
|
|
<!ENTITY % common.entities SYSTEM "../common/entities.ent">
|
4 |
|
|
%common.entities;
|
5 |
|
|
]>
|
6 |
|
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
7 |
|
|
xmlns:exslt="http://exslt.org/common"
|
8 |
|
|
extension-element-prefixes="exslt"
|
9 |
|
|
exclude-result-prefixes="exslt"
|
10 |
|
|
version="1.0">
|
11 |
|
|
|
12 |
|
|
<!-- ********************************************************************
|
13 |
|
|
$Id: autoidx.xsl 8399 2009-04-08 07:37:42Z bobstayton $
|
14 |
|
|
********************************************************************
|
15 |
|
|
|
16 |
|
|
This file is part of the XSL DocBook Stylesheet distribution.
|
17 |
|
|
See ../README or http://docbook.sf.net/release/xsl/current/ for
|
18 |
|
|
copyright and other information.
|
19 |
|
|
|
20 |
|
|
******************************************************************** -->
|
21 |
|
|
|
22 |
|
|
<!-- ==================================================================== -->
|
23 |
|
|
<!-- The "basic" method derived from Jeni Tennison's work. -->
|
24 |
|
|
<!-- The "kosek" method contributed by Jirka Kosek. -->
|
25 |
|
|
<!-- The "kimber" method contributed by Eliot Kimber of Innodata Isogen. -->
|
26 |
|
|
|
27 |
|
|
<xsl:variable name="kimber.imported" select="0"/>
|
28 |
|
|
<xsl:variable name="kosek.imported" select="0"/>
|
29 |
|
|
|
30 |
|
|
<xsl:key name="letter"
|
31 |
|
|
match="indexterm"
|
32 |
|
|
use="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
|
33 |
|
|
|
34 |
|
|
<xsl:key name="primary"
|
35 |
|
|
match="indexterm"
|
36 |
|
|
use="&primary;"/>
|
37 |
|
|
|
38 |
|
|
<xsl:key name="secondary"
|
39 |
|
|
match="indexterm"
|
40 |
|
|
use="concat(&primary;, &sep;, &secondary;)"/>
|
41 |
|
|
|
42 |
|
|
<xsl:key name="tertiary"
|
43 |
|
|
match="indexterm"
|
44 |
|
|
use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;)"/>
|
45 |
|
|
|
46 |
|
|
<xsl:key name="endofrange"
|
47 |
|
|
match="indexterm[@class='endofrange']"
|
48 |
|
|
use="@startref"/>
|
49 |
|
|
|
50 |
|
|
<xsl:key name="primary-section"
|
51 |
|
|
match="indexterm[not(secondary) and not(see)]"
|
52 |
|
|
use="concat(&primary;, &sep;, §ion.id;)"/>
|
53 |
|
|
|
54 |
|
|
<xsl:key name="secondary-section"
|
55 |
|
|
match="indexterm[not(tertiary) and not(see)]"
|
56 |
|
|
use="concat(&primary;, &sep;, &secondary;, &sep;, §ion.id;)"/>
|
57 |
|
|
|
58 |
|
|
<xsl:key name="tertiary-section"
|
59 |
|
|
match="indexterm[not(see)]"
|
60 |
|
|
use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, §ion.id;)"/>
|
61 |
|
|
|
62 |
|
|
<xsl:key name="see-also"
|
63 |
|
|
match="indexterm[seealso]"
|
64 |
|
|
use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, seealso)"/>
|
65 |
|
|
|
66 |
|
|
<xsl:key name="see"
|
67 |
|
|
match="indexterm[see]"
|
68 |
|
|
use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, see)"/>
|
69 |
|
|
|
70 |
|
|
<xsl:key name="sections" match="*[@id or @xml:id]" use="@id|@xml:id"/>
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
<xsl:template name="generate-index">
|
74 |
|
|
<xsl:param name="scope" select="(ancestor::book|/)[last()]"/>
|
75 |
|
|
|
76 |
|
|
<xsl:choose>
|
77 |
|
|
<xsl:when test="$index.method = 'kosek'">
|
78 |
|
|
<xsl:call-template name="generate-kosek-index">
|
79 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
80 |
|
|
</xsl:call-template>
|
81 |
|
|
</xsl:when>
|
82 |
|
|
<xsl:when test="$index.method = 'kimber'">
|
83 |
|
|
<xsl:call-template name="generate-kimber-index">
|
84 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
85 |
|
|
</xsl:call-template>
|
86 |
|
|
</xsl:when>
|
87 |
|
|
|
88 |
|
|
<xsl:otherwise>
|
89 |
|
|
<xsl:call-template name="generate-basic-index">
|
90 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
91 |
|
|
</xsl:call-template>
|
92 |
|
|
</xsl:otherwise>
|
93 |
|
|
</xsl:choose>
|
94 |
|
|
</xsl:template>
|
95 |
|
|
|
96 |
|
|
<xsl:template name="generate-basic-index">
|
97 |
|
|
<xsl:param name="scope" select="NOTANODE"/>
|
98 |
|
|
|
99 |
|
|
<xsl:variable name="role">
|
100 |
|
|
<xsl:if test="$index.on.role != 0">
|
101 |
|
|
<xsl:value-of select="@role"/>
|
102 |
|
|
</xsl:if>
|
103 |
|
|
</xsl:variable>
|
104 |
|
|
|
105 |
|
|
<xsl:variable name="type">
|
106 |
|
|
<xsl:if test="$index.on.type != 0">
|
107 |
|
|
<xsl:value-of select="@type"/>
|
108 |
|
|
</xsl:if>
|
109 |
|
|
</xsl:variable>
|
110 |
|
|
|
111 |
|
|
<xsl:variable name="terms"
|
112 |
|
|
select="//indexterm
|
113 |
|
|
[count(.|key('letter',
|
114 |
|
|
translate(substring(&primary;, 1, 1),
|
115 |
|
|
&lowercase;,
|
116 |
|
|
&uppercase;))
|
117 |
|
|
[&scope;][1]) = 1
|
118 |
|
|
and not(@class = 'endofrange')]"/>
|
119 |
|
|
|
120 |
|
|
<xsl:variable name="alphabetical"
|
121 |
|
|
select="$terms[contains(concat(&lowercase;, &uppercase;),
|
122 |
|
|
substring(&primary;, 1, 1))]"/>
|
123 |
|
|
|
124 |
|
|
<xsl:variable name="others" select="$terms[not(contains(concat(&lowercase;,
|
125 |
|
|
&uppercase;),
|
126 |
|
|
substring(&primary;, 1, 1)))]"/>
|
127 |
|
|
<div class="index">
|
128 |
|
|
<xsl:if test="$others">
|
129 |
|
|
<div class="indexdiv">
|
130 |
|
|
<h3>
|
131 |
|
|
<xsl:call-template name="gentext">
|
132 |
|
|
<xsl:with-param name="key" select="'index symbols'"/>
|
133 |
|
|
</xsl:call-template>
|
134 |
|
|
</h3>
|
135 |
|
|
<dl>
|
136 |
|
|
<xsl:apply-templates select="$others[count(.|key('primary',
|
137 |
|
|
&primary;)[&scope;][1]) = 1]"
|
138 |
|
|
mode="index-symbol-div">
|
139 |
|
|
<xsl:with-param name="position" select="position()"/>
|
140 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
141 |
|
|
<xsl:with-param name="role" select="$role"/>
|
142 |
|
|
<xsl:with-param name="type" select="$type"/>
|
143 |
|
|
<xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
144 |
|
|
</xsl:apply-templates>
|
145 |
|
|
</dl>
|
146 |
|
|
</div>
|
147 |
|
|
</xsl:if>
|
148 |
|
|
|
149 |
|
|
<xsl:apply-templates select="$alphabetical[count(.|key('letter',
|
150 |
|
|
translate(substring(&primary;, 1, 1),
|
151 |
|
|
&lowercase;,&uppercase;))[&scope;][1]) = 1]"
|
152 |
|
|
mode="index-div-basic">
|
153 |
|
|
<xsl:with-param name="position" select="position()"/>
|
154 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
155 |
|
|
<xsl:with-param name="role" select="$role"/>
|
156 |
|
|
<xsl:with-param name="type" select="$type"/>
|
157 |
|
|
<xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
158 |
|
|
</xsl:apply-templates>
|
159 |
|
|
</div>
|
160 |
|
|
</xsl:template>
|
161 |
|
|
|
162 |
|
|
<!-- This template not used if html/autoidx-kosek.xsl is imported -->
|
163 |
|
|
<xsl:template name="generate-kosek-index">
|
164 |
|
|
<xsl:param name="scope" select="NOTANODE"/>
|
165 |
|
|
|
166 |
|
|
<xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
|
167 |
|
|
<xsl:if test="contains($vendor, 'libxslt')">
|
168 |
|
|
<xsl:message terminate="yes">
|
169 |
|
|
<xsl:text>ERROR: the 'kosek' index method does not </xsl:text>
|
170 |
|
|
<xsl:text>work with the xsltproc XSLT processor.</xsl:text>
|
171 |
|
|
</xsl:message>
|
172 |
|
|
</xsl:if>
|
173 |
|
|
|
174 |
|
|
|
175 |
|
|
<xsl:if test="$exsl.node.set.available = 0">
|
176 |
|
|
<xsl:message terminate="yes">
|
177 |
|
|
<xsl:text>ERROR: the 'kosek' index method requires the </xsl:text>
|
178 |
|
|
<xsl:text>exslt:node-set() function. Use a processor that </xsl:text>
|
179 |
|
|
<xsl:text>has it, or use a different index method.</xsl:text>
|
180 |
|
|
</xsl:message>
|
181 |
|
|
</xsl:if>
|
182 |
|
|
|
183 |
|
|
<xsl:if test="$kosek.imported = 0">
|
184 |
|
|
<xsl:message terminate="yes">
|
185 |
|
|
<xsl:text>ERROR: the 'kosek' index method requires the
</xsl:text>
|
186 |
|
|
<xsl:text>kosek index extensions be imported:
</xsl:text>
|
187 |
|
|
<xsl:text> xsl:import href="html/autoidx-kosek.xsl"</xsl:text>
|
188 |
|
|
</xsl:message>
|
189 |
|
|
</xsl:if>
|
190 |
|
|
|
191 |
|
|
</xsl:template>
|
192 |
|
|
|
193 |
|
|
<!-- This template not used if html/autoidx-kimber.xsl is imported -->
|
194 |
|
|
<xsl:template name="generate-kimber-index">
|
195 |
|
|
<xsl:param name="scope" select="NOTANODE"/>
|
196 |
|
|
|
197 |
|
|
<xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
|
198 |
|
|
<xsl:if test="not(contains($vendor, 'SAXON '))">
|
199 |
|
|
<xsl:message terminate="yes">
|
200 |
|
|
<xsl:text>ERROR: the 'kimber' index method requires the </xsl:text>
|
201 |
|
|
<xsl:text>Saxon version 6 or 8 XSLT processor.</xsl:text>
|
202 |
|
|
</xsl:message>
|
203 |
|
|
</xsl:if>
|
204 |
|
|
|
205 |
|
|
<xsl:if test="$kimber.imported = 0">
|
206 |
|
|
<xsl:message terminate="yes">
|
207 |
|
|
<xsl:text>ERROR: the 'kimber' index method requires the
</xsl:text>
|
208 |
|
|
<xsl:text>kimber index extensions be imported:
</xsl:text>
|
209 |
|
|
<xsl:text> xsl:import href="html/autoidx-kimber.xsl"</xsl:text>
|
210 |
|
|
</xsl:message>
|
211 |
|
|
</xsl:if>
|
212 |
|
|
|
213 |
|
|
</xsl:template>
|
214 |
|
|
|
215 |
|
|
<xsl:template match="indexterm" mode="index-div-basic">
|
216 |
|
|
<xsl:param name="scope" select="."/>
|
217 |
|
|
<xsl:param name="role" select="''"/>
|
218 |
|
|
<xsl:param name="type" select="''"/>
|
219 |
|
|
|
220 |
|
|
<xsl:variable name="key"
|
221 |
|
|
select="translate(substring(&primary;, 1, 1),
|
222 |
|
|
&lowercase;,&uppercase;)"/>
|
223 |
|
|
|
224 |
|
|
<xsl:if test="key('letter', $key)[&scope;]
|
225 |
|
|
[count(.|key('primary', &primary;)[&scope;][1]) = 1]">
|
226 |
|
|
<div class="indexdiv">
|
227 |
|
|
<xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)">
|
228 |
|
|
<h3>
|
229 |
|
|
<xsl:value-of select="translate($key, &lowercase;, &uppercase;)"/>
|
230 |
|
|
</h3>
|
231 |
|
|
</xsl:if>
|
232 |
|
|
<dl>
|
233 |
|
|
<xsl:apply-templates select="key('letter', $key)[&scope;]
|
234 |
|
|
[count(.|key('primary', &primary;)
|
235 |
|
|
[&scope;][1])=1]"
|
236 |
|
|
mode="index-primary">
|
237 |
|
|
<xsl:with-param name="position" select="position()"/>
|
238 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
239 |
|
|
<xsl:with-param name="role" select="$role"/>
|
240 |
|
|
<xsl:with-param name="type" select="$type"/>
|
241 |
|
|
<xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
242 |
|
|
</xsl:apply-templates>
|
243 |
|
|
</dl>
|
244 |
|
|
</div>
|
245 |
|
|
</xsl:if>
|
246 |
|
|
</xsl:template>
|
247 |
|
|
|
248 |
|
|
<xsl:template match="indexterm" mode="index-symbol-div">
|
249 |
|
|
<xsl:param name="scope" select="/"/>
|
250 |
|
|
<xsl:param name="role" select="''"/>
|
251 |
|
|
<xsl:param name="type" select="''"/>
|
252 |
|
|
|
253 |
|
|
<xsl:variable name="key" select="translate(substring(&primary;, 1, 1),
|
254 |
|
|
&lowercase;,&uppercase;)"/>
|
255 |
|
|
|
256 |
|
|
<xsl:apply-templates select="key('letter', $key)
|
257 |
|
|
[&scope;][count(.|key('primary', &primary;)[1]) = 1]"
|
258 |
|
|
mode="index-primary">
|
259 |
|
|
<xsl:with-param name="position" select="position()"/>
|
260 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
261 |
|
|
<xsl:with-param name="role" select="$role"/>
|
262 |
|
|
<xsl:with-param name="type" select="$type"/>
|
263 |
|
|
<xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
264 |
|
|
</xsl:apply-templates>
|
265 |
|
|
</xsl:template>
|
266 |
|
|
|
267 |
|
|
<xsl:template match="indexterm" mode="index-primary">
|
268 |
|
|
<xsl:param name="scope" select="."/>
|
269 |
|
|
<xsl:param name="role" select="''"/>
|
270 |
|
|
<xsl:param name="type" select="''"/>
|
271 |
|
|
|
272 |
|
|
<xsl:variable name="key" select="&primary;"/>
|
273 |
|
|
<xsl:variable name="refs" select="key('primary', $key)[&scope;]"/>
|
274 |
|
|
<dt>
|
275 |
|
|
<xsl:for-each select="$refs/primary">
|
276 |
|
|
<xsl:if test="@id or @xml:id">
|
277 |
|
|
<a name="{(@id|@xml:id)[1]}"/>
|
278 |
|
|
</xsl:if>
|
279 |
|
|
</xsl:for-each>
|
280 |
|
|
<xsl:value-of select="primary"/>
|
281 |
|
|
<xsl:choose>
|
282 |
|
|
<xsl:when test="$index.links.to.section = 1">
|
283 |
|
|
<xsl:for-each select="$refs[generate-id() = generate-id(key('primary-section', concat($key, &sep;, §ion.id;))[&scope;][1])]">
|
284 |
|
|
<xsl:apply-templates select="." mode="reference">
|
285 |
|
|
<xsl:with-param name="position" select="position()"/>
|
286 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
287 |
|
|
<xsl:with-param name="role" select="$role"/>
|
288 |
|
|
<xsl:with-param name="type" select="$type"/>
|
289 |
|
|
</xsl:apply-templates>
|
290 |
|
|
</xsl:for-each>
|
291 |
|
|
</xsl:when>
|
292 |
|
|
<xsl:otherwise>
|
293 |
|
|
<xsl:for-each select="$refs[&scope;]">
|
294 |
|
|
<xsl:apply-templates select="." mode="reference">
|
295 |
|
|
<xsl:with-param name="position" select="position()"/>
|
296 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
297 |
|
|
<xsl:with-param name="role" select="$role"/>
|
298 |
|
|
<xsl:with-param name="type" select="$type"/>
|
299 |
|
|
</xsl:apply-templates>
|
300 |
|
|
</xsl:for-each>
|
301 |
|
|
</xsl:otherwise>
|
302 |
|
|
</xsl:choose>
|
303 |
|
|
|
304 |
|
|
<xsl:if test="$refs[not(secondary)]/*[self::see]">
|
305 |
|
|
<xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &sep;, &sep;, see))[&scope;][1])]"
|
306 |
|
|
mode="index-see">
|
307 |
|
|
<xsl:with-param name="position" select="position()"/>
|
308 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
309 |
|
|
<xsl:with-param name="role" select="$role"/>
|
310 |
|
|
<xsl:with-param name="type" select="$type"/>
|
311 |
|
|
<xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
|
312 |
|
|
</xsl:apply-templates>
|
313 |
|
|
</xsl:if>
|
314 |
|
|
</dt>
|
315 |
|
|
<xsl:if test="$refs/secondary or $refs[not(secondary)]/*[self::seealso]">
|
316 |
|
|
<dd>
|
317 |
|
|
<dl>
|
318 |
|
|
<xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &sep;, &sep;, seealso))[&scope;][1])]"
|
319 |
|
|
mode="index-seealso">
|
320 |
|
|
<xsl:with-param name="position" select="position()"/>
|
321 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
322 |
|
|
<xsl:with-param name="role" select="$role"/>
|
323 |
|
|
<xsl:with-param name="type" select="$type"/>
|
324 |
|
|
<xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
|
325 |
|
|
</xsl:apply-templates>
|
326 |
|
|
<xsl:apply-templates select="$refs[secondary and count(.|key('secondary', concat($key, &sep;, &secondary;))[&scope;][1]) = 1]"
|
327 |
|
|
mode="index-secondary">
|
328 |
|
|
<xsl:with-param name="position" select="position()"/>
|
329 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
330 |
|
|
<xsl:with-param name="role" select="$role"/>
|
331 |
|
|
<xsl:with-param name="type" select="$type"/>
|
332 |
|
|
<xsl:sort select="translate(&secondary;, &lowercase;, &uppercase;)"/>
|
333 |
|
|
</xsl:apply-templates>
|
334 |
|
|
</dl>
|
335 |
|
|
</dd>
|
336 |
|
|
</xsl:if>
|
337 |
|
|
</xsl:template>
|
338 |
|
|
|
339 |
|
|
<xsl:template match="indexterm" mode="index-secondary">
|
340 |
|
|
<xsl:param name="scope" select="."/>
|
341 |
|
|
<xsl:param name="role" select="''"/>
|
342 |
|
|
<xsl:param name="type" select="''"/>
|
343 |
|
|
|
344 |
|
|
<xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;)"/>
|
345 |
|
|
<xsl:variable name="refs" select="key('secondary', $key)[&scope;]"/>
|
346 |
|
|
<dt>
|
347 |
|
|
<xsl:for-each select="$refs/secondary">
|
348 |
|
|
<xsl:if test="@id or @xml:id">
|
349 |
|
|
<a name="{(@id|@xml:id)[1]}"/>
|
350 |
|
|
</xsl:if>
|
351 |
|
|
</xsl:for-each>
|
352 |
|
|
<xsl:value-of select="secondary"/>
|
353 |
|
|
<xsl:choose>
|
354 |
|
|
<xsl:when test="$index.links.to.section = 1">
|
355 |
|
|
<xsl:for-each select="$refs[generate-id() = generate-id(key('secondary-section', concat($key, &sep;, §ion.id;))[&scope;][1])]">
|
356 |
|
|
<xsl:apply-templates select="." mode="reference">
|
357 |
|
|
<xsl:with-param name="position" select="position()"/>
|
358 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
359 |
|
|
<xsl:with-param name="role" select="$role"/>
|
360 |
|
|
<xsl:with-param name="type" select="$type"/>
|
361 |
|
|
</xsl:apply-templates>
|
362 |
|
|
</xsl:for-each>
|
363 |
|
|
</xsl:when>
|
364 |
|
|
<xsl:otherwise>
|
365 |
|
|
<xsl:for-each select="$refs[&scope;]">
|
366 |
|
|
<xsl:apply-templates select="." mode="reference">
|
367 |
|
|
<xsl:with-param name="position" select="position()"/>
|
368 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
369 |
|
|
<xsl:with-param name="role" select="$role"/>
|
370 |
|
|
<xsl:with-param name="type" select="$type"/>
|
371 |
|
|
</xsl:apply-templates>
|
372 |
|
|
</xsl:for-each>
|
373 |
|
|
</xsl:otherwise>
|
374 |
|
|
</xsl:choose>
|
375 |
|
|
|
376 |
|
|
<xsl:if test="$refs[not(tertiary)]/*[self::see]">
|
377 |
|
|
<xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &secondary;, &sep;, &sep;, see))[&scope;][1])]"
|
378 |
|
|
mode="index-see">
|
379 |
|
|
<xsl:with-param name="position" select="position()"/>
|
380 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
381 |
|
|
<xsl:with-param name="role" select="$role"/>
|
382 |
|
|
<xsl:with-param name="type" select="$type"/>
|
383 |
|
|
<xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
|
384 |
|
|
</xsl:apply-templates>
|
385 |
|
|
</xsl:if>
|
386 |
|
|
</dt>
|
387 |
|
|
<xsl:if test="$refs/tertiary or $refs[not(tertiary)]/*[self::seealso]">
|
388 |
|
|
<dd>
|
389 |
|
|
<dl>
|
390 |
|
|
<xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &secondary;, &sep;, &sep;, seealso))[&scope;][1])]"
|
391 |
|
|
mode="index-seealso">
|
392 |
|
|
<xsl:with-param name="position" select="position()"/>
|
393 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
394 |
|
|
<xsl:with-param name="role" select="$role"/>
|
395 |
|
|
<xsl:with-param name="type" select="$type"/>
|
396 |
|
|
<xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
|
397 |
|
|
</xsl:apply-templates>
|
398 |
|
|
<xsl:apply-templates select="$refs[tertiary and count(.|key('tertiary', concat($key, &sep;, &tertiary;))[&scope;][1]) = 1]"
|
399 |
|
|
mode="index-tertiary">
|
400 |
|
|
<xsl:with-param name="position" select="position()"/>
|
401 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
402 |
|
|
<xsl:with-param name="role" select="$role"/>
|
403 |
|
|
<xsl:with-param name="type" select="$type"/>
|
404 |
|
|
<xsl:sort select="translate(&tertiary;, &lowercase;, &uppercase;)"/>
|
405 |
|
|
</xsl:apply-templates>
|
406 |
|
|
</dl>
|
407 |
|
|
</dd>
|
408 |
|
|
</xsl:if>
|
409 |
|
|
</xsl:template>
|
410 |
|
|
|
411 |
|
|
<xsl:template match="indexterm" mode="index-tertiary">
|
412 |
|
|
<xsl:param name="scope" select="."/>
|
413 |
|
|
<xsl:param name="role" select="''"/>
|
414 |
|
|
<xsl:param name="type" select="''"/>
|
415 |
|
|
|
416 |
|
|
<xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;)"/>
|
417 |
|
|
<xsl:variable name="refs" select="key('tertiary', $key)[&scope;]"/>
|
418 |
|
|
<dt>
|
419 |
|
|
<xsl:for-each select="$refs/tertiary">
|
420 |
|
|
<xsl:if test="@id or @xml:id">
|
421 |
|
|
<a name="{(@id|@xml:id)[1]}"/>
|
422 |
|
|
</xsl:if>
|
423 |
|
|
</xsl:for-each>
|
424 |
|
|
<xsl:value-of select="tertiary"/>
|
425 |
|
|
<xsl:choose>
|
426 |
|
|
<xsl:when test="$index.links.to.section = 1">
|
427 |
|
|
<xsl:for-each select="$refs[generate-id() = generate-id(key('tertiary-section', concat($key, &sep;, §ion.id;))[&scope;][1])]">
|
428 |
|
|
<xsl:apply-templates select="." mode="reference">
|
429 |
|
|
<xsl:with-param name="position" select="position()"/>
|
430 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
431 |
|
|
<xsl:with-param name="role" select="$role"/>
|
432 |
|
|
<xsl:with-param name="type" select="$type"/>
|
433 |
|
|
</xsl:apply-templates>
|
434 |
|
|
</xsl:for-each>
|
435 |
|
|
</xsl:when>
|
436 |
|
|
<xsl:otherwise>
|
437 |
|
|
<xsl:for-each select="$refs[&scope;]">
|
438 |
|
|
<xsl:apply-templates select="." mode="reference">
|
439 |
|
|
<xsl:with-param name="position" select="position()"/>
|
440 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
441 |
|
|
<xsl:with-param name="role" select="$role"/>
|
442 |
|
|
<xsl:with-param name="type" select="$type"/>
|
443 |
|
|
</xsl:apply-templates>
|
444 |
|
|
</xsl:for-each>
|
445 |
|
|
</xsl:otherwise>
|
446 |
|
|
</xsl:choose>
|
447 |
|
|
|
448 |
|
|
<xsl:if test="$refs/see">
|
449 |
|
|
<xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, see))[&scope;][1])]"
|
450 |
|
|
mode="index-see">
|
451 |
|
|
<xsl:with-param name="position" select="position()"/>
|
452 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
453 |
|
|
<xsl:with-param name="role" select="$role"/>
|
454 |
|
|
<xsl:with-param name="type" select="$type"/>
|
455 |
|
|
<xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
|
456 |
|
|
</xsl:apply-templates>
|
457 |
|
|
</xsl:if>
|
458 |
|
|
</dt>
|
459 |
|
|
<xsl:if test="$refs/seealso">
|
460 |
|
|
<dd>
|
461 |
|
|
<dl>
|
462 |
|
|
<xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, seealso))[&scope;][1])]"
|
463 |
|
|
mode="index-seealso">
|
464 |
|
|
<xsl:with-param name="position" select="position()"/>
|
465 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
466 |
|
|
<xsl:with-param name="role" select="$role"/>
|
467 |
|
|
<xsl:with-param name="type" select="$type"/>
|
468 |
|
|
<xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
|
469 |
|
|
</xsl:apply-templates>
|
470 |
|
|
</dl>
|
471 |
|
|
</dd>
|
472 |
|
|
</xsl:if>
|
473 |
|
|
</xsl:template>
|
474 |
|
|
|
475 |
|
|
<xsl:template match="indexterm" mode="reference">
|
476 |
|
|
<xsl:param name="scope" select="."/>
|
477 |
|
|
<xsl:param name="role" select="''"/>
|
478 |
|
|
<xsl:param name="type" select="''"/>
|
479 |
|
|
<xsl:param name="position"/>
|
480 |
|
|
|
481 |
|
|
<xsl:variable name="term.separator">
|
482 |
|
|
<xsl:call-template name="index.separator">
|
483 |
|
|
<xsl:with-param name="key" select="'index.term.separator'"/>
|
484 |
|
|
</xsl:call-template>
|
485 |
|
|
</xsl:variable>
|
486 |
|
|
|
487 |
|
|
<xsl:variable name="number.separator">
|
488 |
|
|
<xsl:call-template name="index.separator">
|
489 |
|
|
<xsl:with-param name="key" select="'index.number.separator'"/>
|
490 |
|
|
</xsl:call-template>
|
491 |
|
|
</xsl:variable>
|
492 |
|
|
|
493 |
|
|
<xsl:variable name="range.separator">
|
494 |
|
|
<xsl:call-template name="index.separator">
|
495 |
|
|
<xsl:with-param name="key" select="'index.range.separator'"/>
|
496 |
|
|
</xsl:call-template>
|
497 |
|
|
</xsl:variable>
|
498 |
|
|
|
499 |
|
|
<xsl:choose>
|
500 |
|
|
<xsl:when test="$position = 1">
|
501 |
|
|
<xsl:value-of select="$term.separator"/>
|
502 |
|
|
</xsl:when>
|
503 |
|
|
<xsl:otherwise>
|
504 |
|
|
<xsl:value-of select="$number.separator"/>
|
505 |
|
|
</xsl:otherwise>
|
506 |
|
|
</xsl:choose>
|
507 |
|
|
|
508 |
|
|
<xsl:choose>
|
509 |
|
|
<xsl:when test="@zone and string(@zone)">
|
510 |
|
|
<xsl:call-template name="reference">
|
511 |
|
|
<xsl:with-param name="zones" select="normalize-space(@zone)"/>
|
512 |
|
|
<xsl:with-param name="position" select="position()"/>
|
513 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
514 |
|
|
<xsl:with-param name="role" select="$role"/>
|
515 |
|
|
<xsl:with-param name="type" select="$type"/>
|
516 |
|
|
</xsl:call-template>
|
517 |
|
|
</xsl:when>
|
518 |
|
|
<xsl:otherwise>
|
519 |
|
|
<a>
|
520 |
|
|
<xsl:apply-templates select="." mode="class.attribute"/>
|
521 |
|
|
<xsl:variable name="title">
|
522 |
|
|
<xsl:choose>
|
523 |
|
|
<xsl:when test="§ion;/titleabbrev and $index.prefer.titleabbrev != 0">
|
524 |
|
|
<xsl:apply-templates select="§ion;" mode="titleabbrev.markup"/>
|
525 |
|
|
</xsl:when>
|
526 |
|
|
<xsl:otherwise>
|
527 |
|
|
<xsl:apply-templates select="§ion;" mode="title.markup"/>
|
528 |
|
|
</xsl:otherwise>
|
529 |
|
|
</xsl:choose>
|
530 |
|
|
</xsl:variable>
|
531 |
|
|
|
532 |
|
|
<xsl:attribute name="href">
|
533 |
|
|
<xsl:choose>
|
534 |
|
|
<xsl:when test="$index.links.to.section = 1">
|
535 |
|
|
<xsl:call-template name="href.target">
|
536 |
|
|
<xsl:with-param name="object" select="§ion;"/>
|
537 |
|
|
<xsl:with-param name="context" select="//index[&scope;][1]"/>
|
538 |
|
|
</xsl:call-template>
|
539 |
|
|
</xsl:when>
|
540 |
|
|
<xsl:otherwise>
|
541 |
|
|
<xsl:call-template name="href.target">
|
542 |
|
|
<xsl:with-param name="object" select="."/>
|
543 |
|
|
<xsl:with-param name="context" select="//index[&scope;][1]"/>
|
544 |
|
|
</xsl:call-template>
|
545 |
|
|
</xsl:otherwise>
|
546 |
|
|
</xsl:choose>
|
547 |
|
|
|
548 |
|
|
</xsl:attribute>
|
549 |
|
|
|
550 |
|
|
<xsl:value-of select="$title"/> <!-- text only -->
|
551 |
|
|
</a>
|
552 |
|
|
|
553 |
|
|
<xsl:variable name="id" select="(@id|@xml:id)[1]"/>
|
554 |
|
|
<xsl:if test="key('endofrange', $id)[&scope;]">
|
555 |
|
|
<xsl:apply-templates select="key('endofrange', $id)[&scope;][last()]"
|
556 |
|
|
mode="reference">
|
557 |
|
|
<xsl:with-param name="position" select="position()"/>
|
558 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
559 |
|
|
<xsl:with-param name="role" select="$role"/>
|
560 |
|
|
<xsl:with-param name="type" select="$type"/>
|
561 |
|
|
<xsl:with-param name="separator" select="$range.separator"/>
|
562 |
|
|
</xsl:apply-templates>
|
563 |
|
|
</xsl:if>
|
564 |
|
|
</xsl:otherwise>
|
565 |
|
|
</xsl:choose>
|
566 |
|
|
</xsl:template>
|
567 |
|
|
|
568 |
|
|
<xsl:template name="reference">
|
569 |
|
|
<xsl:param name="scope" select="."/>
|
570 |
|
|
<xsl:param name="role" select="''"/>
|
571 |
|
|
<xsl:param name="type" select="''"/>
|
572 |
|
|
<xsl:param name="zones"/>
|
573 |
|
|
|
574 |
|
|
<xsl:choose>
|
575 |
|
|
<xsl:when test="contains($zones, ' ')">
|
576 |
|
|
<xsl:variable name="zone" select="substring-before($zones, ' ')"/>
|
577 |
|
|
<xsl:variable name="target" select="key('sections', $zone)"/>
|
578 |
|
|
|
579 |
|
|
<a>
|
580 |
|
|
<xsl:apply-templates select="." mode="class.attribute"/>
|
581 |
|
|
<xsl:attribute name="href">
|
582 |
|
|
<xsl:call-template name="href.target">
|
583 |
|
|
<xsl:with-param name="object" select="$target[1]"/>
|
584 |
|
|
<xsl:with-param name="context" select="//index[&scope;][1]"/>
|
585 |
|
|
</xsl:call-template>
|
586 |
|
|
</xsl:attribute>
|
587 |
|
|
<xsl:apply-templates select="$target[1]" mode="index-title-content"/>
|
588 |
|
|
</a>
|
589 |
|
|
<xsl:text>, </xsl:text>
|
590 |
|
|
<xsl:call-template name="reference">
|
591 |
|
|
<xsl:with-param name="zones" select="substring-after($zones, ' ')"/>
|
592 |
|
|
<xsl:with-param name="position" select="position()"/>
|
593 |
|
|
<xsl:with-param name="scope" select="$scope"/>
|
594 |
|
|
<xsl:with-param name="role" select="$role"/>
|
595 |
|
|
<xsl:with-param name="type" select="$type"/>
|
596 |
|
|
</xsl:call-template>
|
597 |
|
|
</xsl:when>
|
598 |
|
|
<xsl:otherwise>
|
599 |
|
|
<xsl:variable name="zone" select="$zones"/>
|
600 |
|
|
<xsl:variable name="target" select="key('sections', $zone)"/>
|
601 |
|
|
|
602 |
|
|
<a>
|
603 |
|
|
<xsl:apply-templates select="." mode="class.attribute"/>
|
604 |
|
|
<xsl:attribute name="href">
|
605 |
|
|
<xsl:call-template name="href.target">
|
606 |
|
|
<xsl:with-param name="object" select="$target[1]"/>
|
607 |
|
|
<xsl:with-param name="context" select="//index[&scope;][1]"/>
|
608 |
|
|
</xsl:call-template>
|
609 |
|
|
</xsl:attribute>
|
610 |
|
|
<xsl:apply-templates select="$target[1]" mode="index-title-content"/>
|
611 |
|
|
</a>
|
612 |
|
|
</xsl:otherwise>
|
613 |
|
|
</xsl:choose>
|
614 |
|
|
</xsl:template>
|
615 |
|
|
|
616 |
|
|
<xsl:template match="indexterm" mode="index-see">
|
617 |
|
|
<xsl:param name="scope" select="."/>
|
618 |
|
|
<xsl:param name="role" select="''"/>
|
619 |
|
|
<xsl:param name="type" select="''"/>
|
620 |
|
|
|
621 |
|
|
<xsl:text> (</xsl:text>
|
622 |
|
|
<xsl:call-template name="gentext">
|
623 |
|
|
<xsl:with-param name="key" select="'see'"/>
|
624 |
|
|
</xsl:call-template>
|
625 |
|
|
<xsl:text> </xsl:text>
|
626 |
|
|
<xsl:value-of select="see"/>
|
627 |
|
|
<xsl:text>)</xsl:text>
|
628 |
|
|
</xsl:template>
|
629 |
|
|
|
630 |
|
|
<xsl:template match="indexterm" mode="index-seealso">
|
631 |
|
|
<xsl:param name="scope" select="."/>
|
632 |
|
|
<xsl:param name="role" select="''"/>
|
633 |
|
|
<xsl:param name="type" select="''"/>
|
634 |
|
|
|
635 |
|
|
<xsl:for-each select="seealso">
|
636 |
|
|
<xsl:sort select="translate(., &lowercase;, &uppercase;)"/>
|
637 |
|
|
<dt>
|
638 |
|
|
<xsl:text>(</xsl:text>
|
639 |
|
|
<xsl:call-template name="gentext">
|
640 |
|
|
<xsl:with-param name="key" select="'seealso'"/>
|
641 |
|
|
</xsl:call-template>
|
642 |
|
|
<xsl:text> </xsl:text>
|
643 |
|
|
<xsl:value-of select="."/>
|
644 |
|
|
<xsl:text>)</xsl:text>
|
645 |
|
|
</dt>
|
646 |
|
|
</xsl:for-each>
|
647 |
|
|
</xsl:template>
|
648 |
|
|
|
649 |
|
|
<xsl:template match="*" mode="index-title-content">
|
650 |
|
|
<xsl:variable name="title">
|
651 |
|
|
<xsl:apply-templates select="§ion;" mode="title.markup"/>
|
652 |
|
|
</xsl:variable>
|
653 |
|
|
|
654 |
|
|
<xsl:value-of select="$title"/>
|
655 |
|
|
</xsl:template>
|
656 |
|
|
|
657 |
|
|
<xsl:template name="index.separator">
|
658 |
|
|
<xsl:param name="key" select="''"/>
|
659 |
|
|
<xsl:param name="lang">
|
660 |
|
|
<xsl:call-template name="l10n.language"/>
|
661 |
|
|
</xsl:param>
|
662 |
|
|
|
663 |
|
|
<xsl:choose>
|
664 |
|
|
<xsl:when test="$key = 'index.term.separator'">
|
665 |
|
|
<xsl:choose>
|
666 |
|
|
<!-- Use the override if not blank -->
|
667 |
|
|
<xsl:when test="$index.term.separator != ''">
|
668 |
|
|
<xsl:copy-of select="$index.term.separator"/>
|
669 |
|
|
</xsl:when>
|
670 |
|
|
<xsl:otherwise>
|
671 |
|
|
<xsl:call-template name="gentext.template">
|
672 |
|
|
<xsl:with-param name="lang" select="$lang"/>
|
673 |
|
|
<xsl:with-param name="context">index</xsl:with-param>
|
674 |
|
|
<xsl:with-param name="name">term-separator</xsl:with-param>
|
675 |
|
|
</xsl:call-template>
|
676 |
|
|
</xsl:otherwise>
|
677 |
|
|
</xsl:choose>
|
678 |
|
|
</xsl:when>
|
679 |
|
|
<xsl:when test="$key = 'index.number.separator'">
|
680 |
|
|
<xsl:choose>
|
681 |
|
|
<!-- Use the override if not blank -->
|
682 |
|
|
<xsl:when test="$index.number.separator != ''">
|
683 |
|
|
<xsl:copy-of select="$index.number.separator"/>
|
684 |
|
|
</xsl:when>
|
685 |
|
|
<xsl:otherwise>
|
686 |
|
|
<xsl:call-template name="gentext.template">
|
687 |
|
|
<xsl:with-param name="lang" select="$lang"/>
|
688 |
|
|
<xsl:with-param name="context">index</xsl:with-param>
|
689 |
|
|
<xsl:with-param name="name">number-separator</xsl:with-param>
|
690 |
|
|
</xsl:call-template>
|
691 |
|
|
</xsl:otherwise>
|
692 |
|
|
</xsl:choose>
|
693 |
|
|
</xsl:when>
|
694 |
|
|
<xsl:when test="$key = 'index.range.separator'">
|
695 |
|
|
<xsl:choose>
|
696 |
|
|
<!-- Use the override if not blank -->
|
697 |
|
|
<xsl:when test="$index.range.separator != ''">
|
698 |
|
|
<xsl:copy-of select="$index.range.separator"/>
|
699 |
|
|
</xsl:when>
|
700 |
|
|
<xsl:otherwise>
|
701 |
|
|
<xsl:call-template name="gentext.template">
|
702 |
|
|
<xsl:with-param name="lang" select="$lang"/>
|
703 |
|
|
<xsl:with-param name="context">index</xsl:with-param>
|
704 |
|
|
<xsl:with-param name="name">range-separator</xsl:with-param>
|
705 |
|
|
</xsl:call-template>
|
706 |
|
|
</xsl:otherwise>
|
707 |
|
|
</xsl:choose>
|
708 |
|
|
</xsl:when>
|
709 |
|
|
</xsl:choose>
|
710 |
|
|
</xsl:template>
|
711 |
|
|
|
712 |
|
|
</xsl:stylesheet>
|