1 | <?xml version="1.0"?>
|
---|
2 | <!DOCTYPE xsl:stylesheet [
|
---|
3 |
|
---|
4 | <!ENTITY lowercase "'abcdefghijklmnopqrstuvwxyz'">
|
---|
5 | <!ENTITY uppercase "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'">
|
---|
6 |
|
---|
7 | <!ENTITY primary 'normalize-space(concat(primary/@sortas, primary[not(@sortas)]))'>
|
---|
8 | <!ENTITY secondary 'normalize-space(concat(secondary/@sortas, secondary[not(@sortas)]))'>
|
---|
9 | <!ENTITY tertiary 'normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)]))'>
|
---|
10 |
|
---|
11 | <!ENTITY section '(ancestor-or-self::set
|
---|
12 | |ancestor-or-self::book
|
---|
13 | |ancestor-or-self::part
|
---|
14 | |ancestor-or-self::reference
|
---|
15 | |ancestor-or-self::partintro
|
---|
16 | |ancestor-or-self::chapter
|
---|
17 | |ancestor-or-self::appendix
|
---|
18 | |ancestor-or-self::preface
|
---|
19 | |ancestor-or-self::article
|
---|
20 | |ancestor-or-self::section
|
---|
21 | |ancestor-or-self::sect1
|
---|
22 | |ancestor-or-self::sect2
|
---|
23 | |ancestor-or-self::sect3
|
---|
24 | |ancestor-or-self::sect4
|
---|
25 | |ancestor-or-self::sect5
|
---|
26 | |ancestor-or-self::refentry
|
---|
27 | |ancestor-or-self::refsect1
|
---|
28 | |ancestor-or-self::refsect2
|
---|
29 | |ancestor-or-self::refsect3
|
---|
30 | |ancestor-or-self::simplesect
|
---|
31 | |ancestor-or-self::bibliography
|
---|
32 | |ancestor-or-self::glossary
|
---|
33 | |ancestor-or-self::index
|
---|
34 | |ancestor-or-self::webpage)[last()]'>
|
---|
35 |
|
---|
36 | <!ENTITY section.id 'generate-id(§ion;)'>
|
---|
37 | <!ENTITY sep '" "'>
|
---|
38 | <!ENTITY scope 'count(ancestor::node()|$scope) = count(ancestor::node())
|
---|
39 | and ($role = @role or $type = @type or
|
---|
40 | (string-length($role) = 0 and string-length($type) = 0))'>
|
---|
41 | ]>
|
---|
42 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
43 | version="1.0">
|
---|
44 |
|
---|
45 | <!-- ********************************************************************
|
---|
46 | $Id: autoidx.xsl,v 1.26 2005/01/13 08:52:14 bobstayton Exp $
|
---|
47 | ********************************************************************
|
---|
48 |
|
---|
49 | This file is part of the XSL DocBook Stylesheet distribution.
|
---|
50 | See ../README or http://nwalsh.com/docbook/xsl/ for copyright
|
---|
51 | and other information.
|
---|
52 |
|
---|
53 | ******************************************************************** -->
|
---|
54 |
|
---|
55 | <!-- ==================================================================== -->
|
---|
56 | <!-- Jeni Tennison gets all the credit for what follows.
|
---|
57 | I think I understand it :-) Anyway, I've hacked it a bit, so the
|
---|
58 | bugs are mine. -->
|
---|
59 |
|
---|
60 | <xsl:key name="letter"
|
---|
61 | match="indexterm"
|
---|
62 | use="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
|
---|
63 |
|
---|
64 | <xsl:key name="primary"
|
---|
65 | match="indexterm"
|
---|
66 | use="&primary;"/>
|
---|
67 |
|
---|
68 | <xsl:key name="secondary"
|
---|
69 | match="indexterm"
|
---|
70 | use="concat(&primary;, &sep;, &secondary;)"/>
|
---|
71 |
|
---|
72 | <xsl:key name="tertiary"
|
---|
73 | match="indexterm"
|
---|
74 | use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;)"/>
|
---|
75 |
|
---|
76 | <xsl:key name="endofrange"
|
---|
77 | match="indexterm[@class='endofrange']"
|
---|
78 | use="@startref"/>
|
---|
79 |
|
---|
80 | <xsl:key name="primary-section"
|
---|
81 | match="indexterm[not(secondary) and not(see)]"
|
---|
82 | use="concat(&primary;, &sep;, §ion.id;)"/>
|
---|
83 |
|
---|
84 | <xsl:key name="secondary-section"
|
---|
85 | match="indexterm[not(tertiary) and not(see)]"
|
---|
86 | use="concat(&primary;, &sep;, &secondary;, &sep;, §ion.id;)"/>
|
---|
87 |
|
---|
88 | <xsl:key name="tertiary-section"
|
---|
89 | match="indexterm[not(see)]"
|
---|
90 | use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, §ion.id;)"/>
|
---|
91 |
|
---|
92 | <xsl:key name="see-also"
|
---|
93 | match="indexterm[seealso]"
|
---|
94 | use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, seealso)"/>
|
---|
95 |
|
---|
96 | <xsl:key name="see"
|
---|
97 | match="indexterm[see]"
|
---|
98 | use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, see)"/>
|
---|
99 |
|
---|
100 | <xsl:key name="sections" match="*[@id]" use="@id"/>
|
---|
101 |
|
---|
102 | <xsl:template name="generate-index">
|
---|
103 | <xsl:param name="scope" select="(ancestor::book|/)[last()]"/>
|
---|
104 |
|
---|
105 | <xsl:variable name="role">
|
---|
106 | <xsl:if test="$index.on.role != 0">
|
---|
107 | <xsl:value-of select="@role"/>
|
---|
108 | </xsl:if>
|
---|
109 | </xsl:variable>
|
---|
110 |
|
---|
111 | <xsl:variable name="type">
|
---|
112 | <xsl:if test="$index.on.type != 0">
|
---|
113 | <xsl:value-of select="@type"/>
|
---|
114 | </xsl:if>
|
---|
115 | </xsl:variable>
|
---|
116 |
|
---|
117 | <xsl:variable name="terms"
|
---|
118 | select="//indexterm[count(.|key('letter',
|
---|
119 | translate(substring(&primary;, 1, 1),
|
---|
120 | &lowercase;,
|
---|
121 | &uppercase;))[&scope;][1]) = 1
|
---|
122 | and not(@class = 'endofrange')]"/>
|
---|
123 |
|
---|
124 | <xsl:variable name="alphabetical"
|
---|
125 | select="$terms[contains(concat(&lowercase;, &uppercase;),
|
---|
126 | substring(&primary;, 1, 1))]"/>
|
---|
127 |
|
---|
128 | <xsl:variable name="others" select="$terms[not(contains(concat(&lowercase;,
|
---|
129 | &uppercase;),
|
---|
130 | substring(&primary;, 1, 1)))]"/>
|
---|
131 | <div class="index">
|
---|
132 | <xsl:if test="$others">
|
---|
133 | <div class="indexdiv">
|
---|
134 | <h3>
|
---|
135 | <xsl:call-template name="gentext">
|
---|
136 | <xsl:with-param name="key" select="'index symbols'"/>
|
---|
137 | </xsl:call-template>
|
---|
138 | </h3>
|
---|
139 | <dl>
|
---|
140 | <xsl:apply-templates select="$others[count(.|key('primary',
|
---|
141 | &primary;)[&scope;][1]) = 1]"
|
---|
142 | mode="index-symbol-div">
|
---|
143 | <xsl:with-param name="scope" select="$scope"/>
|
---|
144 | <xsl:with-param name="role" select="$role"/>
|
---|
145 | <xsl:with-param name="type" select="$type"/>
|
---|
146 | <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
---|
147 | </xsl:apply-templates>
|
---|
148 | </dl>
|
---|
149 | </div>
|
---|
150 | </xsl:if>
|
---|
151 |
|
---|
152 | <xsl:apply-templates select="$alphabetical[count(.|key('letter',
|
---|
153 | translate(substring(&primary;, 1, 1),
|
---|
154 | &lowercase;,&uppercase;))[&scope;][1]) = 1]"
|
---|
155 | mode="index-div">
|
---|
156 | <xsl:with-param name="scope" select="$scope"/>
|
---|
157 | <xsl:with-param name="role" select="$role"/>
|
---|
158 | <xsl:with-param name="type" select="$type"/>
|
---|
159 | <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
---|
160 | </xsl:apply-templates>
|
---|
161 | </div>
|
---|
162 | </xsl:template>
|
---|
163 |
|
---|
164 | <xsl:template match="indexterm" mode="index-div">
|
---|
165 | <xsl:param name="scope" select="."/>
|
---|
166 | <xsl:param name="role" select="''"/>
|
---|
167 | <xsl:param name="type" select="''"/>
|
---|
168 |
|
---|
169 | <xsl:variable name="key"
|
---|
170 | select="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
|
---|
171 |
|
---|
172 | <!-- Make sure that we don't generate a div if there are no terms in scope -->
|
---|
173 | <xsl:if test="key('letter', $key)[&scope;]
|
---|
174 | [count(.|key('primary', &primary;)[&scope;][1]) = 1]">
|
---|
175 | <div class="indexdiv">
|
---|
176 | <xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)">
|
---|
177 | <h3>
|
---|
178 | <xsl:value-of select="translate($key, &lowercase;, &uppercase;)"/>
|
---|
179 | </h3>
|
---|
180 | </xsl:if>
|
---|
181 | <dl>
|
---|
182 | <xsl:apply-templates select="key('letter', $key)[&scope;]
|
---|
183 | [count(.|key('primary', &primary;)[&scope;][1])=1]"
|
---|
184 | mode="index-primary">
|
---|
185 | <xsl:with-param name="scope" select="$scope"/>
|
---|
186 | <xsl:with-param name="role" select="$role"/>
|
---|
187 | <xsl:with-param name="type" select="$type"/>
|
---|
188 | <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
---|
189 | </xsl:apply-templates>
|
---|
190 | </dl>
|
---|
191 | </div>
|
---|
192 | </xsl:if>
|
---|
193 | </xsl:template>
|
---|
194 |
|
---|
195 | <xsl:template match="indexterm" mode="index-symbol-div">
|
---|
196 | <xsl:param name="scope" select="/"/>
|
---|
197 | <xsl:param name="role" select="''"/>
|
---|
198 | <xsl:param name="type" select="''"/>
|
---|
199 |
|
---|
200 | <xsl:variable name="key" select="translate(substring(&primary;, 1, 1),
|
---|
201 | &lowercase;,&uppercase;)"/>
|
---|
202 |
|
---|
203 | <xsl:apply-templates select="key('letter', $key)
|
---|
204 | [&scope;][count(.|key('primary', &primary;)[1]) = 1]"
|
---|
205 | mode="index-primary">
|
---|
206 | <xsl:with-param name="scope" select="$scope"/>
|
---|
207 | <xsl:with-param name="role" select="$role"/>
|
---|
208 | <xsl:with-param name="type" select="$type"/>
|
---|
209 | <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
---|
210 | </xsl:apply-templates>
|
---|
211 | </xsl:template>
|
---|
212 |
|
---|
213 | <xsl:template match="indexterm" mode="index-primary">
|
---|
214 | <xsl:param name="scope" select="."/>
|
---|
215 | <xsl:param name="role" select="''"/>
|
---|
216 | <xsl:param name="type" select="''"/>
|
---|
217 |
|
---|
218 | <xsl:variable name="key" select="&primary;"/>
|
---|
219 | <xsl:variable name="refs" select="key('primary', $key)[&scope;]"/>
|
---|
220 | <dt>
|
---|
221 | <xsl:value-of select="primary"/>
|
---|
222 | <xsl:for-each select="$refs[generate-id() = generate-id(key('primary-section', concat($key, &sep;, §ion.id;))[&scope;][1])]">
|
---|
223 | <xsl:apply-templates select="." mode="reference">
|
---|
224 | <xsl:with-param name="scope" select="$scope"/>
|
---|
225 | <xsl:with-param name="role" select="$role"/>
|
---|
226 | <xsl:with-param name="type" select="$type"/>
|
---|
227 | </xsl:apply-templates>
|
---|
228 | </xsl:for-each>
|
---|
229 |
|
---|
230 | <xsl:if test="$refs[not(secondary)]/*[self::see]">
|
---|
231 | <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &sep;, &sep;, see))[&scope;][1])]"
|
---|
232 | mode="index-see">
|
---|
233 | <xsl:with-param name="scope" select="$scope"/>
|
---|
234 | <xsl:with-param name="role" select="$role"/>
|
---|
235 | <xsl:with-param name="type" select="$type"/>
|
---|
236 | <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
|
---|
237 | </xsl:apply-templates>
|
---|
238 | </xsl:if>
|
---|
239 | </dt>
|
---|
240 | <xsl:if test="$refs/secondary or $refs[not(secondary)]/*[self::seealso]">
|
---|
241 | <dd>
|
---|
242 | <dl>
|
---|
243 | <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &sep;, &sep;, seealso))[&scope;][1])]"
|
---|
244 | mode="index-seealso">
|
---|
245 | <xsl:with-param name="scope" select="$scope"/>
|
---|
246 | <xsl:with-param name="role" select="$role"/>
|
---|
247 | <xsl:with-param name="type" select="$type"/>
|
---|
248 | <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
|
---|
249 | </xsl:apply-templates>
|
---|
250 | <xsl:apply-templates select="$refs[secondary and count(.|key('secondary', concat($key, &sep;, &secondary;))[&scope;][1]) = 1]"
|
---|
251 | mode="index-secondary">
|
---|
252 | <xsl:with-param name="scope" select="$scope"/>
|
---|
253 | <xsl:with-param name="role" select="$role"/>
|
---|
254 | <xsl:with-param name="type" select="$type"/>
|
---|
255 | <xsl:sort select="translate(&secondary;, &lowercase;, &uppercase;)"/>
|
---|
256 | </xsl:apply-templates>
|
---|
257 | </dl>
|
---|
258 | </dd>
|
---|
259 | </xsl:if>
|
---|
260 | </xsl:template>
|
---|
261 |
|
---|
262 | <xsl:template match="indexterm" mode="index-secondary">
|
---|
263 | <xsl:param name="scope" select="."/>
|
---|
264 | <xsl:param name="role" select="''"/>
|
---|
265 | <xsl:param name="type" select="''"/>
|
---|
266 |
|
---|
267 | <xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;)"/>
|
---|
268 | <xsl:variable name="refs" select="key('secondary', $key)[&scope;]"/>
|
---|
269 | <dt>
|
---|
270 | <xsl:value-of select="secondary"/>
|
---|
271 | <xsl:for-each select="$refs[generate-id() = generate-id(key('secondary-section', concat($key, &sep;, §ion.id;))[&scope;][1])]">
|
---|
272 | <xsl:apply-templates select="." mode="reference">
|
---|
273 | <xsl:with-param name="scope" select="$scope"/>
|
---|
274 | <xsl:with-param name="role" select="$role"/>
|
---|
275 | <xsl:with-param name="type" select="$type"/>
|
---|
276 | </xsl:apply-templates>
|
---|
277 | </xsl:for-each>
|
---|
278 |
|
---|
279 | <xsl:if test="$refs[not(tertiary)]/*[self::see]">
|
---|
280 | <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &secondary;, &sep;, &sep;, see))[&scope;][1])]"
|
---|
281 | mode="index-see">
|
---|
282 | <xsl:with-param name="scope" select="$scope"/>
|
---|
283 | <xsl:with-param name="role" select="$role"/>
|
---|
284 | <xsl:with-param name="type" select="$type"/>
|
---|
285 | <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
|
---|
286 | </xsl:apply-templates>
|
---|
287 | </xsl:if>
|
---|
288 | </dt>
|
---|
289 | <xsl:if test="$refs/tertiary or $refs[not(tertiary)]/*[self::seealso]">
|
---|
290 | <dd>
|
---|
291 | <dl>
|
---|
292 | <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &secondary;, &sep;, &sep;, seealso))[&scope;][1])]"
|
---|
293 | mode="index-seealso">
|
---|
294 | <xsl:with-param name="scope" select="$scope"/>
|
---|
295 | <xsl:with-param name="role" select="$role"/>
|
---|
296 | <xsl:with-param name="type" select="$type"/>
|
---|
297 | <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
|
---|
298 | </xsl:apply-templates>
|
---|
299 | <xsl:apply-templates select="$refs[tertiary and count(.|key('tertiary', concat($key, &sep;, &tertiary;))[&scope;][1]) = 1]"
|
---|
300 | mode="index-tertiary">
|
---|
301 | <xsl:with-param name="scope" select="$scope"/>
|
---|
302 | <xsl:with-param name="role" select="$role"/>
|
---|
303 | <xsl:with-param name="type" select="$type"/>
|
---|
304 | <xsl:sort select="translate(&tertiary;, &lowercase;, &uppercase;)"/>
|
---|
305 | </xsl:apply-templates>
|
---|
306 | </dl>
|
---|
307 | </dd>
|
---|
308 | </xsl:if>
|
---|
309 | </xsl:template>
|
---|
310 |
|
---|
311 | <xsl:template match="indexterm" mode="index-tertiary">
|
---|
312 | <xsl:param name="scope" select="."/>
|
---|
313 | <xsl:param name="role" select="''"/>
|
---|
314 | <xsl:param name="type" select="''"/>
|
---|
315 |
|
---|
316 | <xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;)"/>
|
---|
317 | <xsl:variable name="refs" select="key('tertiary', $key)[&scope;]"/>
|
---|
318 | <dt>
|
---|
319 | <xsl:value-of select="tertiary"/>
|
---|
320 | <xsl:for-each select="$refs[generate-id() = generate-id(key('tertiary-section', concat($key, &sep;, §ion.id;))[&scope;][1])]">
|
---|
321 | <xsl:apply-templates select="." mode="reference">
|
---|
322 | <xsl:with-param name="scope" select="$scope"/>
|
---|
323 | <xsl:with-param name="role" select="$role"/>
|
---|
324 | <xsl:with-param name="type" select="$type"/>
|
---|
325 | </xsl:apply-templates>
|
---|
326 | </xsl:for-each>
|
---|
327 |
|
---|
328 | <xsl:if test="$refs/see">
|
---|
329 | <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, see))[&scope;][1])]"
|
---|
330 | mode="index-see">
|
---|
331 | <xsl:with-param name="scope" select="$scope"/>
|
---|
332 | <xsl:with-param name="role" select="$role"/>
|
---|
333 | <xsl:with-param name="type" select="$type"/>
|
---|
334 | <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
|
---|
335 | </xsl:apply-templates>
|
---|
336 | </xsl:if>
|
---|
337 | </dt>
|
---|
338 | <xsl:if test="$refs/seealso">
|
---|
339 | <dd>
|
---|
340 | <dl>
|
---|
341 | <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, seealso))[&scope;][1])]"
|
---|
342 | mode="index-seealso">
|
---|
343 | <xsl:with-param name="scope" select="$scope"/>
|
---|
344 | <xsl:with-param name="role" select="$role"/>
|
---|
345 | <xsl:with-param name="type" select="$type"/>
|
---|
346 | <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
|
---|
347 | </xsl:apply-templates>
|
---|
348 | </dl>
|
---|
349 | </dd>
|
---|
350 | </xsl:if>
|
---|
351 | </xsl:template>
|
---|
352 |
|
---|
353 | <xsl:template match="indexterm" mode="reference">
|
---|
354 | <xsl:param name="scope" select="."/>
|
---|
355 | <xsl:param name="role" select="''"/>
|
---|
356 | <xsl:param name="type" select="''"/>
|
---|
357 | <xsl:param name="separator" select="', '"/>
|
---|
358 |
|
---|
359 | <xsl:value-of select="$separator"/>
|
---|
360 | <xsl:choose>
|
---|
361 | <xsl:when test="@zone and string(@zone)">
|
---|
362 | <xsl:call-template name="reference">
|
---|
363 | <xsl:with-param name="zones" select="normalize-space(@zone)"/>
|
---|
364 | <xsl:with-param name="scope" select="$scope"/>
|
---|
365 | <xsl:with-param name="role" select="$role"/>
|
---|
366 | <xsl:with-param name="type" select="$type"/>
|
---|
367 | </xsl:call-template>
|
---|
368 | </xsl:when>
|
---|
369 | <xsl:otherwise>
|
---|
370 | <a>
|
---|
371 | <xsl:variable name="title">
|
---|
372 | <xsl:choose>
|
---|
373 | <xsl:when test="§ion;/titleabbrev and $index.prefer.titleabbrev != 0">
|
---|
374 | <xsl:apply-templates select="§ion;" mode="titleabbrev.markup"/>
|
---|
375 | </xsl:when>
|
---|
376 | <xsl:otherwise>
|
---|
377 | <xsl:apply-templates select="§ion;" mode="title.markup"/>
|
---|
378 | </xsl:otherwise>
|
---|
379 | </xsl:choose>
|
---|
380 | </xsl:variable>
|
---|
381 |
|
---|
382 | <xsl:attribute name="href">
|
---|
383 | <xsl:call-template name="href.target">
|
---|
384 | <xsl:with-param name="object" select="§ion;"/>
|
---|
385 | <xsl:with-param name="context" select="//index[&scope;][1]"/>
|
---|
386 | </xsl:call-template>
|
---|
387 | </xsl:attribute>
|
---|
388 |
|
---|
389 | <xsl:value-of select="$title"/> <!-- text only -->
|
---|
390 | </a>
|
---|
391 |
|
---|
392 | <xsl:if test="key('endofrange', @id)[&scope;]">
|
---|
393 | <xsl:apply-templates select="key('endofrange', @id)[&scope;][last()]"
|
---|
394 | mode="reference">
|
---|
395 | <xsl:with-param name="scope" select="$scope"/>
|
---|
396 | <xsl:with-param name="role" select="$role"/>
|
---|
397 | <xsl:with-param name="type" select="$type"/>
|
---|
398 | <xsl:with-param name="separator" select="'-'"/>
|
---|
399 | </xsl:apply-templates>
|
---|
400 | </xsl:if>
|
---|
401 | </xsl:otherwise>
|
---|
402 | </xsl:choose>
|
---|
403 | </xsl:template>
|
---|
404 |
|
---|
405 | <xsl:template name="reference">
|
---|
406 | <xsl:param name="scope" select="."/>
|
---|
407 | <xsl:param name="role" select="''"/>
|
---|
408 | <xsl:param name="type" select="''"/>
|
---|
409 | <xsl:param name="zones"/>
|
---|
410 |
|
---|
411 | <xsl:choose>
|
---|
412 | <xsl:when test="contains($zones, ' ')">
|
---|
413 | <xsl:variable name="zone" select="substring-before($zones, ' ')"/>
|
---|
414 | <xsl:variable name="target" select="key('sections', $zone)[&scope;]"/>
|
---|
415 |
|
---|
416 | <a>
|
---|
417 | <xsl:attribute name="href">
|
---|
418 | <xsl:call-template name="href.target">
|
---|
419 | <xsl:with-param name="object" select="$target[1]"/>
|
---|
420 | <xsl:with-param name="context" select="//index[&scope;][1]"/>
|
---|
421 | </xsl:call-template>
|
---|
422 | </xsl:attribute>
|
---|
423 | <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
|
---|
424 | </a>
|
---|
425 | <xsl:text>, </xsl:text>
|
---|
426 | <xsl:call-template name="reference">
|
---|
427 | <xsl:with-param name="zones" select="substring-after($zones, ' ')"/>
|
---|
428 | <xsl:with-param name="scope" select="$scope"/>
|
---|
429 | <xsl:with-param name="role" select="$role"/>
|
---|
430 | <xsl:with-param name="type" select="$type"/>
|
---|
431 | </xsl:call-template>
|
---|
432 | </xsl:when>
|
---|
433 | <xsl:otherwise>
|
---|
434 | <xsl:variable name="zone" select="$zones"/>
|
---|
435 | <xsl:variable name="target" select="key('sections', $zone)[&scope;]"/>
|
---|
436 |
|
---|
437 | <a>
|
---|
438 | <xsl:attribute name="href">
|
---|
439 | <xsl:call-template name="href.target">
|
---|
440 | <xsl:with-param name="object" select="$target[1]"/>
|
---|
441 | <xsl:with-param name="context" select="//index[&scope;][1]"/>
|
---|
442 | </xsl:call-template>
|
---|
443 | </xsl:attribute>
|
---|
444 | <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
|
---|
445 | </a>
|
---|
446 | </xsl:otherwise>
|
---|
447 | </xsl:choose>
|
---|
448 | </xsl:template>
|
---|
449 |
|
---|
450 | <xsl:template match="indexterm" mode="index-see">
|
---|
451 | <xsl:param name="scope" select="."/>
|
---|
452 | <xsl:param name="role" select="''"/>
|
---|
453 | <xsl:param name="type" select="''"/>
|
---|
454 |
|
---|
455 | <xsl:text> (</xsl:text>
|
---|
456 | <xsl:call-template name="gentext">
|
---|
457 | <xsl:with-param name="key" select="'see'"/>
|
---|
458 | </xsl:call-template>
|
---|
459 | <xsl:text> </xsl:text>
|
---|
460 | <xsl:value-of select="see"/>
|
---|
461 | <xsl:text>)</xsl:text>
|
---|
462 | </xsl:template>
|
---|
463 |
|
---|
464 | <xsl:template match="indexterm" mode="index-seealso">
|
---|
465 | <xsl:param name="scope" select="."/>
|
---|
466 | <xsl:param name="role" select="''"/>
|
---|
467 | <xsl:param name="type" select="''"/>
|
---|
468 |
|
---|
469 | <xsl:for-each select="seealso">
|
---|
470 | <xsl:sort select="translate(., &lowercase;, &uppercase;)"/>
|
---|
471 | <dt>
|
---|
472 | <xsl:text>(</xsl:text>
|
---|
473 | <xsl:call-template name="gentext">
|
---|
474 | <xsl:with-param name="key" select="'seealso'"/>
|
---|
475 | </xsl:call-template>
|
---|
476 | <xsl:text> </xsl:text>
|
---|
477 | <xsl:value-of select="."/>
|
---|
478 | <xsl:text>)</xsl:text>
|
---|
479 | </dt>
|
---|
480 | </xsl:for-each>
|
---|
481 | </xsl:template>
|
---|
482 |
|
---|
483 | <xsl:template match="*" mode="index-title-content">
|
---|
484 | <xsl:variable name="title">
|
---|
485 | <xsl:apply-templates select="§ion;" mode="title.markup"/>
|
---|
486 | </xsl:variable>
|
---|
487 |
|
---|
488 | <xsl:value-of select="$title"/>
|
---|
489 | </xsl:template>
|
---|
490 |
|
---|
491 | </xsl:stylesheet>
|
---|