source: BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/xhtml/glossary.xsl@ bfc344f

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since bfc344f was d7c9f58, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Updated DocBook-XSL code to version 1.73.2

  • Property mode set to 100644
File size: 17.3 KB
RevLine 
[f8c4e94]1<?xml version="1.0" encoding="ASCII"?>
2<!--This file was created automatically by html2xhtml-->
3<!--from the HTML stylesheets.-->
4<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
5
6<!-- ********************************************************************
7 $Id$
8 ********************************************************************
9
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://docbook.sf.net/release/xsl/current/ for
12 copyright and other information.
13
14 ******************************************************************** -->
15
16<!-- ==================================================================== -->
17
18<xsl:template match="glossary">
19
20<xsl:variable name="language">
21 <xsl:call-template name="l10n.language"/>
22</xsl:variable>
23
24<xsl:variable name="lowercase">
25 <xsl:call-template name="gentext">
26 <xsl:with-param name="key">normalize.sort.input</xsl:with-param>
27 </xsl:call-template>
28</xsl:variable>
29
30<xsl:variable name="uppercase">
31 <xsl:call-template name="gentext">
32 <xsl:with-param name="key">normalize.sort.output</xsl:with-param>
33 </xsl:call-template>
34</xsl:variable>
35
36 <xsl:call-template name="id.warning"/>
37
38 <div>
39 <xsl:apply-templates select="." mode="class.attribute"/>
40 <xsl:if test="$generate.id.attributes != 0">
41 <xsl:attribute name="id">
42 <xsl:call-template name="object.id"/>
43 </xsl:attribute>
44 </xsl:if>
45
46 <xsl:call-template name="glossary.titlepage"/>
47
48 <xsl:choose>
49 <xsl:when test="glossdiv">
50 <xsl:apply-templates select="(glossdiv[1]/preceding-sibling::*)"/>
51 </xsl:when>
[d7c9f58]52 <xsl:when test="glossentry">
[f8c4e94]53 <xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
[d7c9f58]54 </xsl:when>
55 <xsl:otherwise>
56 <xsl:apply-templates/>
[f8c4e94]57 </xsl:otherwise>
58 </xsl:choose>
59
60 <xsl:choose>
61 <xsl:when test="glossdiv">
62 <xsl:apply-templates select="glossdiv"/>
63 </xsl:when>
[d7c9f58]64 <xsl:when test="glossentry">
[f8c4e94]65 <dl>
66 <xsl:choose>
67 <xsl:when test="$glossary.sort != 0">
68 <xsl:apply-templates select="glossentry">
69 <xsl:sort lang="{$language}" select="translate(glossterm, $lowercase, $uppercase)"/>
70 </xsl:apply-templates>
71 </xsl:when>
72 <xsl:otherwise>
73 <xsl:apply-templates select="glossentry"/>
74 </xsl:otherwise>
75 </xsl:choose>
76 </dl>
[d7c9f58]77 </xsl:when>
78 <xsl:otherwise>
79 <!-- empty glossary -->
[f8c4e94]80 </xsl:otherwise>
81 </xsl:choose>
82
83 <xsl:if test="not(parent::article)">
84 <xsl:call-template name="process.footnotes"/>
85 </xsl:if>
86 </div>
87</xsl:template>
88
89<xsl:template match="glossary/glossaryinfo"/>
90<xsl:template match="glossary/info"/>
91<xsl:template match="glossary/title"/>
92<xsl:template match="glossary/subtitle"/>
93<xsl:template match="glossary/titleabbrev"/>
94
95<!-- ==================================================================== -->
96
97<xsl:template match="glosslist">
98
99<xsl:variable name="language">
100 <xsl:call-template name="l10n.language"/>
101</xsl:variable>
102
103<xsl:variable name="lowercase">
104 <xsl:call-template name="gentext">
105 <xsl:with-param name="key">normalize.sort.input</xsl:with-param>
106 </xsl:call-template>
107</xsl:variable>
108
109<xsl:variable name="uppercase">
110 <xsl:call-template name="gentext">
111 <xsl:with-param name="key">normalize.sort.output</xsl:with-param>
112 </xsl:call-template>
113</xsl:variable>
114
115 <div>
116 <xsl:apply-templates select="." mode="class.attribute"/>
117 <xsl:call-template name="anchor"/>
118 <xsl:if test="blockinfo/title|info/title|title">
119 <xsl:call-template name="formal.object.heading"/>
120 </xsl:if>
121 <dl>
122 <xsl:choose>
123 <xsl:when test="$glossary.sort != 0">
124 <xsl:apply-templates select="glossentry">
125 <xsl:sort lang="{$language}" select="translate(glossterm, $lowercase, $uppercase)"/>
126 </xsl:apply-templates>
127 </xsl:when>
128 <xsl:otherwise>
129 <xsl:apply-templates select="glossentry"/>
130 </xsl:otherwise>
131 </xsl:choose>
132 </dl>
133 </div>
134</xsl:template>
135
136<!-- ==================================================================== -->
137
138<xsl:template match="glossdiv">
139
140<xsl:variable name="language">
141 <xsl:call-template name="l10n.language"/>
142</xsl:variable>
143
144<xsl:variable name="lowercase">
145 <xsl:call-template name="gentext">
146 <xsl:with-param name="key">normalize.sort.input</xsl:with-param>
147 </xsl:call-template>
148</xsl:variable>
149
150<xsl:variable name="uppercase">
151 <xsl:call-template name="gentext">
152 <xsl:with-param name="key">normalize.sort.output</xsl:with-param>
153 </xsl:call-template>
154</xsl:variable>
155
156 <xsl:call-template name="id.warning"/>
157
158 <div>
159 <xsl:apply-templates select="." mode="class.attribute"/>
160 <xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
161
162 <dl>
163 <xsl:choose>
164 <xsl:when test="$glossary.sort != 0">
165 <xsl:apply-templates select="glossentry">
166 <xsl:sort lang="{$language}" select="translate(glossterm, $lowercase, $uppercase)"/>
167 </xsl:apply-templates>
168 </xsl:when>
169 <xsl:otherwise>
170 <xsl:apply-templates select="glossentry"/>
171 </xsl:otherwise>
172 </xsl:choose>
173 </dl>
174 </div>
175</xsl:template>
176
177<xsl:template match="glossdiv/title">
178 <h3>
179 <xsl:apply-templates select="." mode="class.attribute"/>
180 <xsl:apply-templates/>
181 </h3>
182</xsl:template>
183
184<!-- ==================================================================== -->
185
186<!--
187GlossEntry ::=
188 GlossTerm, Acronym?, Abbrev?,
189 (IndexTerm)*,
190 RevHistory?,
191 (GlossSee | GlossDef+)
192-->
193
194<xsl:template match="glossentry">
195 <xsl:choose>
196 <xsl:when test="$glossentry.show.acronym = 'primary'">
197 <dt>
198 <xsl:call-template name="anchor">
199 <xsl:with-param name="conditional">
200 <xsl:choose>
201 <xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
202 <xsl:otherwise>1</xsl:otherwise>
203 </xsl:choose>
204 </xsl:with-param>
205 </xsl:call-template>
206
207 <xsl:choose>
208 <xsl:when test="acronym|abbrev">
209 <xsl:apply-templates select="acronym|abbrev"/>
210 <xsl:text> (</xsl:text>
211 <xsl:apply-templates select="glossterm"/>
212 <xsl:text>)</xsl:text>
213 </xsl:when>
214 <xsl:otherwise>
215 <xsl:apply-templates select="glossterm"/>
216 </xsl:otherwise>
217 </xsl:choose>
218 </dt>
219 </xsl:when>
220 <xsl:when test="$glossentry.show.acronym = 'yes'">
221 <dt>
222 <xsl:call-template name="anchor">
223 <xsl:with-param name="conditional">
224 <xsl:choose>
225 <xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
226 <xsl:otherwise>1</xsl:otherwise>
227 </xsl:choose>
228 </xsl:with-param>
229 </xsl:call-template>
230
231 <xsl:apply-templates select="glossterm"/>
232
233 <xsl:if test="acronym|abbrev">
234 <xsl:text> (</xsl:text>
235 <xsl:apply-templates select="acronym|abbrev"/>
236 <xsl:text>)</xsl:text>
237 </xsl:if>
238 </dt>
239 </xsl:when>
240 <xsl:otherwise>
241 <dt>
242 <xsl:call-template name="anchor">
243 <xsl:with-param name="conditional">
244 <xsl:choose>
245 <xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
246 <xsl:otherwise>1</xsl:otherwise>
247 </xsl:choose>
248 </xsl:with-param>
249 </xsl:call-template>
250
251 <xsl:apply-templates select="glossterm"/>
252 </dt>
253 </xsl:otherwise>
254 </xsl:choose>
255
256 <xsl:apply-templates select="indexterm|revhistory|glosssee|glossdef"/>
257</xsl:template>
258
259<xsl:template match="glossentry/glossterm">
260 <xsl:apply-templates/>
261 <xsl:if test="following-sibling::glossterm">, </xsl:if>
262</xsl:template>
263
264<xsl:template match="glossentry/acronym">
265 <xsl:apply-templates/>
266 <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
267</xsl:template>
268
269<xsl:template match="glossentry/abbrev">
270 <xsl:apply-templates/>
271 <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
272</xsl:template>
273
274<xsl:template match="glossentry/revhistory">
275</xsl:template>
276
277<xsl:template match="glossentry/glosssee">
278 <xsl:variable name="otherterm" select="@otherterm"/>
279 <xsl:variable name="targets" select="key('id', $otherterm)"/>
280 <xsl:variable name="target" select="$targets[1]"/>
281
282 <dd>
283 <p>
284 <xsl:variable name="template">
285 <xsl:call-template name="gentext.template">
286 <xsl:with-param name="context" select="'glossary'"/>
287 <xsl:with-param name="name" select="'see'"/>
288 </xsl:call-template>
289 </xsl:variable>
290
291 <xsl:variable name="title">
292 <xsl:choose>
293 <xsl:when test="$target">
294 <a>
295 <xsl:apply-templates select="." mode="class.attribute"/>
296 <xsl:attribute name="href">
297 <xsl:call-template name="href.target">
298 <xsl:with-param name="object" select="$target"/>
299 </xsl:call-template>
300 </xsl:attribute>
301 <xsl:apply-templates select="$target" mode="xref-to"/>
302 </a>
303 </xsl:when>
304 <xsl:when test="$otherterm != '' and not($target)">
305 <xsl:message>
306 <xsl:text>Warning: glosssee @otherterm reference not found: </xsl:text>
307 <xsl:value-of select="$otherterm"/>
308 </xsl:message>
309 <xsl:apply-templates/>
310 </xsl:when>
311 <xsl:otherwise>
312 <xsl:apply-templates/>
313 </xsl:otherwise>
314 </xsl:choose>
315 </xsl:variable>
316
317 <xsl:call-template name="substitute-markup">
318 <xsl:with-param name="template" select="$template"/>
319 <xsl:with-param name="title" select="$title"/>
320 </xsl:call-template>
321 <xsl:text>.</xsl:text>
322 </p>
323 </dd>
324</xsl:template>
325
326<xsl:template match="glossentry/glossdef">
327 <dd>
328 <xsl:apply-templates select="*[local-name(.) != 'glossseealso']"/>
329 <xsl:if test="glossseealso">
330 <p>
331 <xsl:variable name="template">
332 <xsl:call-template name="gentext.template">
333 <xsl:with-param name="context" select="'glossary'"/>
334 <xsl:with-param name="name" select="'seealso'"/>
335 </xsl:call-template>
336 </xsl:variable>
337 <xsl:variable name="title">
338 <xsl:apply-templates select="glossseealso"/>
339 </xsl:variable>
340 <xsl:call-template name="substitute-markup">
341 <xsl:with-param name="template" select="$template"/>
342 <xsl:with-param name="title" select="$title"/>
343 </xsl:call-template>
344 </p>
345 </xsl:if>
346 </dd>
347</xsl:template>
348
349<xsl:template match="glossseealso">
350 <xsl:variable name="otherterm" select="@otherterm"/>
351 <xsl:variable name="targets" select="key('id', $otherterm)"/>
352 <xsl:variable name="target" select="$targets[1]"/>
353
354 <xsl:choose>
355 <xsl:when test="$target">
356 <a>
357 <xsl:apply-templates select="." mode="class.attribute"/>
358 <xsl:attribute name="href">
359 <xsl:call-template name="href.target">
360 <xsl:with-param name="object" select="$target"/>
361 </xsl:call-template>
362 </xsl:attribute>
363 <xsl:apply-templates select="$target" mode="xref-to"/>
364 </a>
365 </xsl:when>
366 <xsl:when test="$otherterm != '' and not($target)">
367 <xsl:message>
368 <xsl:text>Warning: glossseealso @otherterm reference not found: </xsl:text>
369 <xsl:value-of select="$otherterm"/>
370 </xsl:message>
371 <xsl:apply-templates/>
372 </xsl:when>
373 <xsl:otherwise>
374 <xsl:apply-templates/>
375 </xsl:otherwise>
376 </xsl:choose>
377
378 <xsl:choose>
379 <xsl:when test="position() = last()">
380 <xsl:text>.</xsl:text>
381 </xsl:when>
382 <xsl:otherwise>
383 <xsl:text>, </xsl:text>
384 </xsl:otherwise>
385 </xsl:choose>
386</xsl:template>
387
388<!-- ==================================================================== -->
389
390<!-- Glossary collection -->
391
392<xsl:template match="glossary[@role='auto']" priority="2">
393
394<xsl:variable name="language">
395 <xsl:call-template name="l10n.language"/>
396</xsl:variable>
397
398<xsl:variable name="lowercase">
399 <xsl:call-template name="gentext">
400 <xsl:with-param name="key">normalize.sort.input</xsl:with-param>
401 </xsl:call-template>
402</xsl:variable>
403
404<xsl:variable name="uppercase">
405 <xsl:call-template name="gentext">
406 <xsl:with-param name="key">normalize.sort.output</xsl:with-param>
407 </xsl:call-template>
408</xsl:variable>
409
410 <xsl:variable name="terms" select="//glossterm[not(parent::glossdef)]|//firstterm"/>
411 <xsl:variable name="collection" select="document($glossary.collection, .)"/>
412
413 <xsl:call-template name="id.warning"/>
414
415 <xsl:if test="$glossary.collection = ''">
416 <xsl:message>
417 <xsl:text>Warning: processing automatic glossary </xsl:text>
418 <xsl:text>without a glossary.collection file.</xsl:text>
419 </xsl:message>
420 </xsl:if>
421
422 <xsl:if test="not($collection) and $glossary.collection != ''">
423 <xsl:message>
424 <xsl:text>Warning: processing automatic glossary but unable to </xsl:text>
425 <xsl:text>open glossary.collection file '</xsl:text>
426 <xsl:value-of select="$glossary.collection"/>
427 <xsl:text>'</xsl:text>
428 </xsl:message>
429 </xsl:if>
430
431 <div>
432 <xsl:apply-templates select="." mode="class.attribute"/>
433 <xsl:if test="$generate.id.attributes != 0">
434 <xsl:attribute name="id">
435 <xsl:call-template name="object.id"/>
436 </xsl:attribute>
437 </xsl:if>
438
439 <xsl:call-template name="glossary.titlepage"/>
440
441 <xsl:choose>
442 <xsl:when test="glossdiv and $collection//glossdiv">
443 <xsl:for-each select="$collection//glossdiv">
444 <!-- first see if there are any in this div -->
445 <xsl:variable name="exist.test">
446 <xsl:for-each select="glossentry">
447 <xsl:variable name="cterm" select="glossterm"/>
448 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
449 <xsl:value-of select="glossterm"/>
450 </xsl:if>
451 </xsl:for-each>
452 </xsl:variable>
453
454 <xsl:if test="$exist.test != ''">
455 <xsl:apply-templates select="." mode="auto-glossary">
456 <xsl:with-param name="terms" select="$terms"/>
457 </xsl:apply-templates>
458 </xsl:if>
459 </xsl:for-each>
460 </xsl:when>
461 <xsl:otherwise>
462 <dl>
463 <xsl:choose>
464 <xsl:when test="$glossary.sort != 0">
465 <xsl:for-each select="$collection//glossentry">
466 <xsl:sort lang="{$language}" select="translate(glossterm, $lowercase, $uppercase)"/>
467 <xsl:variable name="cterm" select="glossterm"/>
468 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
469 <xsl:apply-templates select="." mode="auto-glossary"/>
470 </xsl:if>
471 </xsl:for-each>
472 </xsl:when>
473 <xsl:otherwise>
474 <xsl:for-each select="$collection//glossentry">
475 <xsl:variable name="cterm" select="glossterm"/>
476 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
477 <xsl:apply-templates select="." mode="auto-glossary"/>
478 </xsl:if>
479 </xsl:for-each>
480 </xsl:otherwise>
481 </xsl:choose>
482 </dl>
483 </xsl:otherwise>
484 </xsl:choose>
485
486 <xsl:if test="not(parent::article)">
487 <xsl:call-template name="process.footnotes"/>
488 </xsl:if>
489 </div>
490</xsl:template>
491
492<xsl:template match="*" mode="auto-glossary">
493 <!-- pop back out to the default mode for most elements -->
494 <xsl:apply-templates select="."/>
495</xsl:template>
496
497<xsl:template match="glossdiv" mode="auto-glossary">
498 <xsl:param name="terms" select="."/>
499
500
501<xsl:variable name="language">
502 <xsl:call-template name="l10n.language"/>
503</xsl:variable>
504
505<xsl:variable name="lowercase">
506 <xsl:call-template name="gentext">
507 <xsl:with-param name="key">normalize.sort.input</xsl:with-param>
508 </xsl:call-template>
509</xsl:variable>
510
511<xsl:variable name="uppercase">
512 <xsl:call-template name="gentext">
513 <xsl:with-param name="key">normalize.sort.output</xsl:with-param>
514 </xsl:call-template>
515</xsl:variable>
516
517
518 <div>
519 <xsl:apply-templates select="." mode="class.attribute"/>
520 <xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
521
522 <dl>
523 <xsl:choose>
524 <xsl:when test="$glossary.sort != 0">
525 <xsl:for-each select="glossentry">
526 <xsl:sort lang="{$language}" select="translate(glossterm, $lowercase, $uppercase)"/>
527 <xsl:variable name="cterm" select="glossterm"/>
528 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
529 <xsl:apply-templates select="." mode="auto-glossary"/>
530 </xsl:if>
531 </xsl:for-each>
532 </xsl:when>
533 <xsl:otherwise>
534 <xsl:for-each select="glossentry">
535 <xsl:variable name="cterm" select="glossterm"/>
536 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
537 <xsl:apply-templates select="." mode="auto-glossary"/>
538 </xsl:if>
539 </xsl:for-each>
540 </xsl:otherwise>
541 </xsl:choose>
542 </dl>
543 </div>
544</xsl:template>
545
546<!-- ==================================================================== -->
547
548</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.