2 <!DOCTYPE xsl:stylesheet [
3 <!ENTITY % common.entities SYSTEM "../common/entities.ent">
6 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7 xmlns:fo="http://www.w3.org/1999/XSL/Format"
8 xmlns:xlink='http://www.w3.org/1999/xlink'
9 exclude-result-prefixes="xlink"
12 <!-- ********************************************************************
13 $Id: glossary.xsl 8393 2009-04-02 14:20:44Z dcramer $
14 ********************************************************************
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.
20 ******************************************************************** -->
22 <!-- ==================================================================== -->
24 <xsl:template match="glossary">
25 <xsl:call-template name="make-glossary"/>
28 <xsl:template match="glossdiv/title"/>
29 <xsl:template match="glossdiv/subtitle"/>
30 <xsl:template match="glossdiv/titleabbrev"/>
32 <!-- ==================================================================== -->
34 <xsl:template name="make-glossary">
35 <xsl:param name="divs" select="glossdiv"/>
36 <xsl:param name="entries" select="glossentry"/>
37 <xsl:param name="preamble" select="*[not(self::title
40 or self::glossentry)]"/>
42 &setup-language-variable;
44 <xsl:variable name="id">
45 <xsl:call-template name="object.id"/>
48 <xsl:variable name="presentation">
49 <xsl:call-template name="pi.dbfo_glossary-presentation"/>
52 <xsl:variable name="term-width">
53 <xsl:call-template name="pi.dbfo_glossterm-width"/>
56 <xsl:variable name="width">
58 <xsl:when test="$term-width = ''">
59 <xsl:value-of select="$glossterm.width"/>
62 <xsl:value-of select="$term-width"/>
68 <xsl:call-template name="glossary.titlepage"/>
71 <xsl:if test="$preamble">
72 <xsl:apply-templates select="$preamble"/>
76 <xsl:when test="$presentation = 'list'">
77 <xsl:apply-templates select="$divs" mode="glossary.as.list">
78 <xsl:with-param name="width" select="$width"/>
79 </xsl:apply-templates>
80 <xsl:if test="$entries">
81 <fo:list-block provisional-distance-between-starts="{$width}"
82 provisional-label-separation="{$glossterm.separation}"
83 xsl:use-attribute-sets="normal.para.spacing">
85 <xsl:when test="$glossary.sort != 0">
86 <xsl:apply-templates select="$entries" mode="glossary.as.list">
87 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
88 </xsl:apply-templates>
91 <xsl:apply-templates select="$entries" mode="glossary.as.list"/>
97 <xsl:when test="$presentation = 'blocks'">
98 <xsl:apply-templates select="$divs" mode="glossary.as.blocks"/>
100 <xsl:when test="$glossary.sort != 0">
101 <xsl:apply-templates select="$entries" mode="glossary.as.blocks">
102 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
103 </xsl:apply-templates>
106 <xsl:apply-templates select="$entries" mode="glossary.as.blocks"/>
110 <xsl:when test="$glossary.as.blocks != 0">
111 <xsl:apply-templates select="$divs" mode="glossary.as.blocks"/>
113 <xsl:when test="$glossary.sort != 0">
114 <xsl:apply-templates select="$entries" mode="glossary.as.blocks">
115 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
116 </xsl:apply-templates>
119 <xsl:apply-templates select="$entries" mode="glossary.as.blocks"/>
124 <xsl:apply-templates select="$divs" mode="glossary.as.list">
125 <xsl:with-param name="width" select="$width"/>
126 </xsl:apply-templates>
127 <xsl:if test="$entries">
128 <fo:list-block provisional-distance-between-starts="{$width}"
129 provisional-label-separation="{$glossterm.separation}"
130 xsl:use-attribute-sets="normal.para.spacing">
132 <xsl:when test="$glossary.sort != 0">
133 <xsl:apply-templates select="$entries" mode="glossary.as.list">
134 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
135 </xsl:apply-templates>
138 <xsl:apply-templates select="$entries" mode="glossary.as.list"/>
147 <xsl:template match="book/glossary|part/glossary|/glossary" priority="2">
148 <xsl:variable name="id">
149 <xsl:call-template name="object.id"/>
152 <xsl:variable name="master-reference">
153 <xsl:call-template name="select.pagemaster"/>
156 <fo:page-sequence hyphenate="{$hyphenate}"
157 master-reference="{$master-reference}">
158 <xsl:attribute name="language">
159 <xsl:call-template name="l10n.language"/>
162 <xsl:attribute name="format">
163 <xsl:call-template name="page.number.format">
164 <xsl:with-param name="master-reference" select="$master-reference"/>
168 <xsl:attribute name="initial-page-number">
169 <xsl:call-template name="initial.page.number">
170 <xsl:with-param name="master-reference" select="$master-reference"/>
174 <xsl:attribute name="force-page-count">
175 <xsl:call-template name="force.page.count">
176 <xsl:with-param name="master-reference" select="$master-reference"/>
180 <xsl:attribute name="hyphenation-character">
181 <xsl:call-template name="gentext">
182 <xsl:with-param name="key" select="'hyphenation-character'"/>
185 <xsl:attribute name="hyphenation-push-character-count">
186 <xsl:call-template name="gentext">
187 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
190 <xsl:attribute name="hyphenation-remain-character-count">
191 <xsl:call-template name="gentext">
192 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
196 <xsl:apply-templates select="." mode="running.head.mode">
197 <xsl:with-param name="master-reference" select="$master-reference"/>
198 </xsl:apply-templates>
199 <xsl:apply-templates select="." mode="running.foot.mode">
200 <xsl:with-param name="master-reference" select="$master-reference"/>
201 </xsl:apply-templates>
203 <fo:flow flow-name="xsl-region-body">
204 <xsl:call-template name="set.flow.properties">
205 <xsl:with-param name="element" select="local-name(.)"/>
206 <xsl:with-param name="master-reference" select="$master-reference"/>
209 <xsl:call-template name="make-glossary"/>
214 <xsl:template match="glossary/glossaryinfo"></xsl:template>
215 <xsl:template match="glossary/info"></xsl:template>
216 <xsl:template match="glossary/title"></xsl:template>
217 <xsl:template match="glossary/subtitle"></xsl:template>
218 <xsl:template match="glossary/titleabbrev"></xsl:template>
220 <!-- ==================================================================== -->
222 <xsl:template match="glosslist">
223 &setup-language-variable;
225 <xsl:variable name="presentation">
226 <xsl:call-template name="pi.dbfo_glosslist-presentation"/>
229 <xsl:variable name="term-width">
230 <xsl:call-template name="pi.dbfo_glossterm-width"/>
233 <xsl:variable name="width">
235 <xsl:when test="$term-width = ''">
236 <xsl:value-of select="$glossterm.width"/>
239 <xsl:value-of select="$term-width"/>
244 <xsl:if test="title or info/title">
245 <xsl:apply-templates select="(title|info/title)[1]" mode="list.title.mode"/>
249 <xsl:when test="$presentation = 'list'">
250 <fo:list-block provisional-distance-between-starts="{$width}"
251 provisional-label-separation="{$glossterm.separation}"
252 xsl:use-attribute-sets="normal.para.spacing">
254 <xsl:when test="$glossary.sort != 0">
255 <xsl:apply-templates select="glossentry" mode="glossary.as.list">
256 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
257 </xsl:apply-templates>
260 <xsl:apply-templates select="glossentry" mode="glossary.as.list"/>
265 <xsl:when test="$presentation = 'blocks'">
267 <xsl:when test="$glossary.sort != 0">
268 <xsl:apply-templates select="glossentry" mode="glossary.as.blocks">
269 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
270 </xsl:apply-templates>
273 <xsl:apply-templates select="glossentry" mode="glossary.as.blocks"/>
277 <xsl:when test="$glosslist.as.blocks != 0">
279 <xsl:when test="$glossary.sort != 0">
280 <xsl:apply-templates select="glossentry" mode="glossary.as.blocks">
281 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
282 </xsl:apply-templates>
285 <xsl:apply-templates select="glossentry" mode="glossary.as.blocks"/>
290 <fo:list-block provisional-distance-between-starts="{$width}"
291 provisional-label-separation="{$glossterm.separation}"
292 xsl:use-attribute-sets="normal.para.spacing">
294 <xsl:when test="$glossary.sort != 0">
295 <xsl:apply-templates select="glossentry" mode="glossary.as.list">
296 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
297 </xsl:apply-templates>
300 <xsl:apply-templates select="glossentry" mode="glossary.as.list"/>
308 <!-- ==================================================================== -->
309 <!-- Glossary collection -->
311 <xsl:template match="glossary[@role='auto']" priority="2">
312 <xsl:variable name="collection" select="document($glossary.collection, .)"/>
313 <xsl:if test="$glossary.collection = ''">
315 <xsl:text>Warning: processing automatic glossary </xsl:text>
316 <xsl:text>without a glossary.collection file.</xsl:text>
320 <xsl:if test="not($collection) and $glossary.collection != ''">
322 <xsl:text>Warning: processing automatic glossary but unable to </xsl:text>
323 <xsl:text>open glossary.collection file '</xsl:text>
324 <xsl:value-of select="$glossary.collection"/>
325 <xsl:text>'</xsl:text>
329 <xsl:call-template name="make-auto-glossary"/>
332 <xsl:template name="make-auto-glossary">
333 <xsl:param name="collection" select="document($glossary.collection, .)"/>
334 <xsl:param name="terms" select="//glossterm[not(parent::glossdef)]|//firstterm"/>
335 <xsl:param name="preamble" select="*[not(self::title
338 or self::glossentry)]"/>
340 &setup-language-variable;
342 <xsl:variable name="id">
343 <xsl:call-template name="object.id"/>
346 <xsl:variable name="presentation">
347 <xsl:call-template name="pi.dbfo_glossary-presentation"/>
350 <xsl:variable name="term-width">
351 <xsl:call-template name="pi.dbfo_glossterm-width"/>
354 <xsl:variable name="width">
356 <xsl:when test="$term-width = ''">
357 <xsl:value-of select="$glossterm.width"/>
360 <xsl:value-of select="$term-width"/>
365 <xsl:if test="$glossary.collection = ''">
367 <xsl:text>Warning: processing automatic glossary </xsl:text>
368 <xsl:text>without a glossary.collection file.</xsl:text>
372 <fo:block id="{$id}">
373 <xsl:call-template name="glossary.titlepage"/>
376 <xsl:if test="$preamble">
377 <xsl:apply-templates select="$preamble"/>
381 <xsl:when test="glossdiv and $collection//glossdiv">
382 <xsl:for-each select="$collection//glossdiv">
383 <!-- first see if there are any in this div -->
384 <xsl:variable name="exist.test">
385 <xsl:for-each select="glossentry">
386 <xsl:variable name="cterm" select="glossterm"/>
387 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
388 <xsl:value-of select="glossterm"/>
393 <xsl:if test="$exist.test != ''">
395 <xsl:when test="$presentation = 'list'">
396 <xsl:apply-templates select="." mode="auto-glossary-as-list">
397 <xsl:with-param name="width" select="$width"/>
398 <xsl:with-param name="terms" select="$terms"/>
399 </xsl:apply-templates>
401 <xsl:when test="$presentation = 'blocks'">
402 <xsl:apply-templates select="." mode="auto-glossary-as-blocks">
403 <xsl:with-param name="terms" select="$terms"/>
404 </xsl:apply-templates>
406 <xsl:when test="$glossary.as.blocks != 0">
407 <xsl:apply-templates select="." mode="auto-glossary-as-blocks">
408 <xsl:with-param name="terms" select="$terms"/>
409 </xsl:apply-templates>
412 <xsl:apply-templates select="." mode="auto-glossary-as-list">
413 <xsl:with-param name="width" select="$width"/>
414 <xsl:with-param name="terms" select="$terms"/>
415 </xsl:apply-templates>
423 <xsl:when test="$presentation = 'list'">
424 <fo:list-block provisional-distance-between-starts="{$width}"
425 provisional-label-separation="{$glossterm.separation}"
426 xsl:use-attribute-sets="normal.para.spacing">
428 <xsl:when test="$glossary.sort != 0">
429 <xsl:for-each select="$collection//glossentry">
430 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
431 <xsl:variable name="cterm" select="glossterm"/>
432 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
433 <xsl:apply-templates select="."
434 mode="auto-glossary-as-list"/>
439 <xsl:for-each select="$collection//glossentry">
440 <xsl:variable name="cterm" select="glossterm"/>
441 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
442 <xsl:apply-templates select="."
443 mode="auto-glossary-as-list"/>
450 <xsl:when test="$presentation = 'blocks' or
451 $glossary.as.blocks != 0">
453 <xsl:when test="$glossary.sort != 0">
454 <xsl:for-each select="$collection//glossentry">
455 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
456 <xsl:variable name="cterm" select="glossterm"/>
457 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
458 <xsl:apply-templates select="."
459 mode="auto-glossary-as-blocks"/>
464 <xsl:for-each select="$collection//glossentry">
465 <xsl:variable name="cterm" select="glossterm"/>
466 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
467 <xsl:apply-templates select="."
468 mode="auto-glossary-as-blocks"/>
475 <fo:list-block provisional-distance-between-starts="{$width}"
476 provisional-label-separation="{$glossterm.separation}"
477 xsl:use-attribute-sets="normal.para.spacing">
479 <xsl:when test="$glossary.sort != 0">
480 <xsl:for-each select="$collection//glossentry">
482 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
483 <xsl:variable name="cterm" select="glossterm"/>
484 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
485 <xsl:apply-templates select="."
486 mode="auto-glossary-as-list"/>
491 <xsl:for-each select="$collection//glossentry">
492 <xsl:variable name="cterm" select="glossterm"/>
493 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
494 <xsl:apply-templates select="."
495 mode="auto-glossary-as-list"/>
507 <xsl:template match="book/glossary[@role='auto']|
508 part/glossary[@role='auto']|
509 /glossary[@role='auto']" priority="2.5">
510 <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
512 <xsl:variable name="master-reference">
513 <xsl:call-template name="select.pagemaster"/>
516 <xsl:if test="$glossary.collection = ''">
518 <xsl:text>Warning: processing automatic glossary </xsl:text>
519 <xsl:text>without a glossary.collection file.</xsl:text>
523 <fo:page-sequence hyphenate="{$hyphenate}"
524 master-reference="{$master-reference}">
525 <xsl:attribute name="language">
526 <xsl:call-template name="l10n.language"/>
528 <xsl:attribute name="format">
529 <xsl:call-template name="page.number.format">
530 <xsl:with-param name="master-reference" select="$master-reference"/>
534 <xsl:attribute name="initial-page-number">
535 <xsl:call-template name="initial.page.number">
536 <xsl:with-param name="master-reference" select="$master-reference"/>
540 <xsl:attribute name="force-page-count">
541 <xsl:call-template name="force.page.count">
542 <xsl:with-param name="master-reference" select="$master-reference"/>
546 <xsl:attribute name="hyphenation-character">
547 <xsl:call-template name="gentext">
548 <xsl:with-param name="key" select="'hyphenation-character'"/>
551 <xsl:attribute name="hyphenation-push-character-count">
552 <xsl:call-template name="gentext">
553 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
556 <xsl:attribute name="hyphenation-remain-character-count">
557 <xsl:call-template name="gentext">
558 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
562 <xsl:apply-templates select="." mode="running.head.mode">
563 <xsl:with-param name="master-reference" select="$master-reference"/>
564 </xsl:apply-templates>
565 <xsl:apply-templates select="." mode="running.foot.mode">
566 <xsl:with-param name="master-reference" select="$master-reference"/>
567 </xsl:apply-templates>
569 <fo:flow flow-name="xsl-region-body">
570 <xsl:call-template name="set.flow.properties">
571 <xsl:with-param name="element" select="local-name(.)"/>
572 <xsl:with-param name="master-reference" select="$master-reference"/>
575 <xsl:call-template name="make-auto-glossary"/>
580 <xsl:template match="glossdiv" mode="auto-glossary-as-list">
581 <xsl:param name="width" select="$glossterm.width"/>
582 <xsl:param name="terms" select="."/>
584 &setup-language-variable;
586 <xsl:variable name="preamble"
587 select="*[not(self::title
589 or self::glossentry)]"/>
591 <xsl:call-template name="glossdiv.titlepage"/>
593 <xsl:apply-templates select="$preamble"/>
595 <fo:list-block provisional-distance-between-starts="{$width}"
596 provisional-label-separation="{$glossterm.separation}"
597 xsl:use-attribute-sets="normal.para.spacing">
599 <xsl:when test="$glossary.sort != 0">
600 <xsl:for-each select="glossentry">
601 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
602 <xsl:variable name="cterm" select="glossterm"/>
603 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
604 <xsl:apply-templates select="." mode="auto-glossary-as-list"/>
609 <xsl:for-each select="glossentry">
610 <xsl:variable name="cterm" select="glossterm"/>
611 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
612 <xsl:apply-templates select="." mode="auto-glossary-as-list"/>
620 <xsl:template match="glossentry" mode="auto-glossary-as-list">
621 <xsl:apply-templates select="." mode="glossary.as.list"/>
624 <xsl:template match="glossdiv" mode="auto-glossary-as-blocks">
625 <xsl:param name="terms" select="."/>
627 &setup-language-variable;
629 <xsl:variable name="preamble"
630 select="*[not(self::title
632 or self::glossentry)]"/>
634 <xsl:call-template name="glossdiv.titlepage"/>
636 <xsl:apply-templates select="$preamble"/>
639 <xsl:when test="$glossary.sort != 0">
640 <xsl:for-each select="glossentry">
641 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
642 <xsl:variable name="cterm" select="glossterm"/>
643 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
644 <xsl:apply-templates select="." mode="auto-glossary-as-blocks"/>
649 <xsl:for-each select="glossentry">
650 <xsl:variable name="cterm" select="glossterm"/>
651 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
652 <xsl:apply-templates select="." mode="auto-glossary-as-blocks"/>
660 <xsl:template match="glossentry" mode="auto-glossary-as-blocks">
661 <xsl:apply-templates select="." mode="glossary.as.blocks"/>
664 <!-- ==================================================================== -->
665 <!-- Format glossary as a list -->
667 <xsl:template match="glossdiv" mode="glossary.as.list">
668 <xsl:param name="width" select="$glossterm.width"/>
670 &setup-language-variable;
672 <xsl:variable name="entries" select="glossentry"/>
674 <xsl:variable name="preamble"
675 select="*[not(self::title
677 or self::glossentry)]"/>
679 <xsl:call-template name="glossdiv.titlepage"/>
681 <xsl:apply-templates select="$preamble"/>
683 <fo:list-block provisional-distance-between-starts="{$width}"
684 provisional-label-separation="{$glossterm.separation}"
685 xsl:use-attribute-sets="normal.para.spacing">
687 <xsl:when test="$glossary.sort != 0">
688 <xsl:apply-templates select="$entries" mode="glossary.as.list">
689 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
690 </xsl:apply-templates>
693 <xsl:apply-templates select="$entries" mode="glossary.as.list"/>
701 GlossTerm, Acronym?, Abbrev?,
704 (GlossSee | GlossDef+)
707 <xsl:template match="glossentry" mode="glossary.as.list">
708 <xsl:variable name="id">
709 <xsl:call-template name="object.id"/>
712 <fo:list-item xsl:use-attribute-sets="glossentry.list.item.properties">
713 <xsl:call-template name="anchor">
714 <xsl:with-param name="conditional">
716 <xsl:when test="$glossterm.auto.link != 0
717 or $glossary.collection != ''">0</xsl:when>
718 <xsl:otherwise>1</xsl:otherwise>
723 <fo:list-item-label end-indent="label-end()">
724 <fo:block xsl:use-attribute-sets="glossterm.list.properties">
726 <xsl:when test="$glossentry.show.acronym = 'primary'">
728 <xsl:when test="acronym|abbrev">
729 <xsl:apply-templates select="acronym|abbrev"
730 mode="glossary.as.list"/>
731 <xsl:text> (</xsl:text>
732 <xsl:apply-templates select="glossterm"
733 mode="glossary.as.list"/>
734 <xsl:text>)</xsl:text>
737 <xsl:apply-templates select="glossterm"
738 mode="glossary.as.list"/>
743 <xsl:when test="$glossentry.show.acronym = 'yes'">
744 <xsl:apply-templates select="glossterm" mode="glossary.as.list"/>
746 <xsl:if test="acronym|abbrev">
747 <xsl:text> (</xsl:text>
748 <xsl:apply-templates select="acronym|abbrev"
749 mode="glossary.as.list"/>
750 <xsl:text>)</xsl:text>
755 <xsl:apply-templates select="glossterm" mode="glossary.as.list"/>
758 <xsl:apply-templates select="indexterm"/>
760 </fo:list-item-label>
762 <fo:list-item-body start-indent="body-start()">
763 <fo:block xsl:use-attribute-sets="glossdef.list.properties">
764 <xsl:apply-templates select="glosssee|glossdef" mode="glossary.as.list"/>
770 <xsl:template match="glossentry/glossterm" mode="glossary.as.list">
771 <xsl:variable name="id">
772 <xsl:call-template name="object.id"/>
774 <fo:inline id="{$id}">
775 <xsl:apply-templates/>
777 <xsl:if test="following-sibling::glossterm">, </xsl:if>
780 <xsl:template match="glossentry/acronym" mode="glossary.as.list">
781 <xsl:apply-templates/>
782 <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
785 <xsl:template match="glossentry/abbrev" mode="glossary.as.list">
786 <xsl:apply-templates/>
787 <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
790 <xsl:template match="glossentry/revhistory" mode="glossary.as.list">
793 <xsl:template match="glossentry/glosssee" mode="glossary.as.list">
794 <xsl:variable name="otherterm" select="@otherterm"/>
795 <xsl:variable name="targets" select="key('id', $otherterm)"/>
796 <xsl:variable name="target" select="$targets[1]"/>
797 <xsl:variable name="xlink" select="@xlink:href"/>
800 <xsl:variable name="template">
801 <xsl:call-template name="gentext.template">
802 <xsl:with-param name="context" select="'glossary'"/>
803 <xsl:with-param name="name" select="'see'"/>
806 <xsl:variable name="title">
808 <xsl:when test="$target">
809 <fo:basic-link internal-destination="{$otherterm}"
810 xsl:use-attribute-sets="xref.properties">
811 <xsl:apply-templates select="$target" mode="xref-to"/>
814 <xsl:when test="$xlink">
815 <xsl:call-template name="simple.xlink">
816 <xsl:with-param name="content">
817 <xsl:apply-templates/>
821 <xsl:when test="$otherterm != '' and not($target)">
823 <xsl:text>Warning: glosssee @otherterm reference not found: </xsl:text>
824 <xsl:value-of select="$otherterm"/>
826 <xsl:apply-templates mode="glossary.as.list"/>
829 <xsl:apply-templates mode="glossary.as.list"/>
833 <xsl:call-template name="substitute-markup">
834 <xsl:with-param name="template" select="$template"/>
835 <xsl:with-param name="title" select="$title"/>
840 <xsl:template match="glossentry/glossdef" mode="glossary.as.list">
841 <xsl:apply-templates select="*[local-name(.) != 'glossseealso']"/>
842 <xsl:if test="glossseealso">
844 <xsl:variable name="template">
845 <xsl:call-template name="gentext.template">
846 <xsl:with-param name="context" select="'glossary'"/>
847 <xsl:with-param name="name" select="'seealso'"/>
850 <xsl:variable name="title">
851 <xsl:apply-templates select="glossseealso" mode="glossary.as.list"/>
853 <xsl:call-template name="substitute-markup">
854 <xsl:with-param name="template" select="$template"/>
855 <xsl:with-param name="title" select="$title"/>
861 <xsl:template match="glossentry/glossdef/para[1]|glossentry/glossdef/simpara[1]"
862 mode="glossary.as.list">
864 <xsl:apply-templates/>
868 <xsl:template match="glossseealso" mode="glossary.as.list">
869 <xsl:variable name="otherterm" select="@otherterm"/>
870 <xsl:variable name="targets" select="key('id', $otherterm)"/>
871 <xsl:variable name="target" select="$targets[1]"/>
872 <xsl:variable name="xlink" select="@xlink:href"/>
875 <xsl:when test="$target">
876 <fo:basic-link internal-destination="{$otherterm}"
877 xsl:use-attribute-sets="xref.properties">
878 <xsl:apply-templates select="$target" mode="xref-to"/>
881 <xsl:when test="$xlink">
882 <xsl:call-template name="simple.xlink">
883 <xsl:with-param name="content">
884 <xsl:apply-templates/>
888 <xsl:when test="$otherterm != '' and not($target)">
890 <xsl:text>Warning: glossseealso @otherterm reference not found: </xsl:text>
891 <xsl:value-of select="$otherterm"/>
893 <xsl:apply-templates mode="glossary.as.list"/>
896 <xsl:apply-templates mode="glossary.as.list"/>
901 <xsl:when test="position() = last()"/>
903 <xsl:call-template name="gentext.template">
904 <xsl:with-param name="context" select="'glossary'"/>
905 <xsl:with-param name="name" select="'seealso-separator'"/>
911 <!-- ==================================================================== -->
912 <!-- Format glossary blocks -->
914 <xsl:template match="glossdiv" mode="glossary.as.blocks">
915 &setup-language-variable;
916 <xsl:variable name="entries" select="glossentry"/>
917 <xsl:variable name="preamble"
918 select="*[not(self::title
920 or self::glossentry)]"/>
922 <xsl:call-template name="glossdiv.titlepage"/>
924 <xsl:apply-templates select="$preamble"/>
927 <xsl:when test="$glossary.sort != 0">
928 <xsl:apply-templates select="$entries" mode="glossary.as.blocks">
929 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
930 </xsl:apply-templates>
933 <xsl:apply-templates select="$entries" mode="glossary.as.blocks"/>
940 GlossTerm, Acronym?, Abbrev?,
943 (GlossSee | GlossDef+)
946 <xsl:template match="glossentry" mode="glossary.as.blocks">
947 <xsl:variable name="id">
948 <xsl:call-template name="object.id"/>
951 <fo:block xsl:use-attribute-sets="glossterm.block.properties">
952 <xsl:call-template name="anchor">
953 <xsl:with-param name="conditional">
955 <xsl:when test="$glossterm.auto.link != 0
956 or $glossary.collection != ''">0</xsl:when>
957 <xsl:otherwise>1</xsl:otherwise>
963 <xsl:when test="$glossentry.show.acronym = 'primary'">
965 <xsl:when test="acronym|abbrev">
966 <xsl:apply-templates select="acronym|abbrev" mode="glossary.as.blocks"/>
967 <xsl:text> (</xsl:text>
968 <xsl:apply-templates select="glossterm" mode="glossary.as.blocks"/>
969 <xsl:text>)</xsl:text>
972 <xsl:apply-templates select="glossterm" mode="glossary.as.blocks"/>
977 <xsl:when test="$glossentry.show.acronym = 'yes'">
978 <xsl:apply-templates select="glossterm" mode="glossary.as.blocks"/>
980 <xsl:if test="acronym|abbrev">
981 <xsl:text> (</xsl:text>
982 <xsl:apply-templates select="acronym|abbrev" mode="glossary.as.blocks"/>
983 <xsl:text>)</xsl:text>
988 <xsl:apply-templates select="glossterm" mode="glossary.as.blocks"/>
992 <xsl:apply-templates select="indexterm"/>
995 <fo:block xsl:use-attribute-sets="glossdef.block.properties">
996 <xsl:apply-templates select="glosssee|glossdef" mode="glossary.as.blocks"/>
1000 <xsl:template match="glossentry/glossterm" mode="glossary.as.blocks">
1001 <xsl:variable name="id">
1002 <xsl:call-template name="object.id"/>
1004 <fo:inline id="{$id}">
1005 <xsl:apply-templates/>
1007 <xsl:if test="following-sibling::glossterm">, </xsl:if>
1010 <xsl:template match="glossentry/acronym" mode="glossary.as.blocks">
1011 <xsl:apply-templates/>
1012 <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
1015 <xsl:template match="glossentry/abbrev" mode="glossary.as.blocks">
1016 <xsl:apply-templates/>
1017 <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
1020 <xsl:template match="glossentry/glosssee" mode="glossary.as.blocks">
1021 <xsl:variable name="otherterm" select="@otherterm"/>
1022 <xsl:variable name="targets" select="key('id', $otherterm)"/>
1023 <xsl:variable name="target" select="$targets[1]"/>
1024 <xsl:variable name="xlink" select="@xlink:href"/>
1026 <xsl:variable name="template">
1027 <xsl:call-template name="gentext.template">
1028 <xsl:with-param name="context" select="'glossary'"/>
1029 <xsl:with-param name="name" select="'see'"/>
1030 </xsl:call-template>
1032 <xsl:variable name="title">
1034 <xsl:when test="$target">
1035 <fo:basic-link internal-destination="{$otherterm}"
1036 xsl:use-attribute-sets="xref.properties">
1037 <xsl:apply-templates select="$target" mode="xref-to"/>
1040 <xsl:when test="$xlink">
1041 <xsl:call-template name="simple.xlink">
1042 <xsl:with-param name="content">
1043 <xsl:apply-templates/>
1045 </xsl:call-template>
1047 <xsl:when test="$otherterm != '' and not($target)">
1049 <xsl:text>Warning: glosssee @otherterm reference not found: </xsl:text>
1050 <xsl:value-of select="$otherterm"/>
1052 <xsl:apply-templates mode="glossary.as.blocks"/>
1055 <xsl:apply-templates mode="glossary.as.blocks"/>
1059 <xsl:call-template name="substitute-markup">
1060 <xsl:with-param name="template" select="$template"/>
1061 <xsl:with-param name="title" select="$title"/>
1062 </xsl:call-template>
1065 <xsl:template match="glossentry/glossdef" mode="glossary.as.blocks">
1066 <xsl:apply-templates select="*[local-name(.) != 'glossseealso']"
1067 mode="glossary.as.blocks"/>
1068 <xsl:if test="glossseealso">
1070 <xsl:variable name="template">
1071 <xsl:call-template name="gentext.template">
1072 <xsl:with-param name="context" select="'glossary'"/>
1073 <xsl:with-param name="name" select="'seealso'"/>
1074 </xsl:call-template>
1076 <xsl:variable name="title">
1077 <xsl:apply-templates select="glossseealso" mode="glossary.as.blocks"/>
1079 <xsl:call-template name="substitute-markup">
1080 <xsl:with-param name="template" select="$template"/>
1081 <xsl:with-param name="title" select="$title"/>
1082 </xsl:call-template>
1087 <xsl:template match="glossentry/glossdef/para[1]|glossentry/glossdef/simpara[1]"
1088 mode="glossary.as.blocks">
1090 <xsl:apply-templates/>
1094 <!-- Handle any other glossdef content normally -->
1095 <xsl:template match="*" mode="glossary.as.blocks">
1096 <xsl:apply-templates select="." />
1099 <xsl:template match="glossseealso" mode="glossary.as.blocks">
1100 <xsl:variable name="otherterm" select="@otherterm"/>
1101 <xsl:variable name="targets" select="key('id', $otherterm)"/>
1102 <xsl:variable name="target" select="$targets[1]"/>
1103 <xsl:variable name="xlink" select="@xlink:href"/>
1106 <xsl:when test="$target">
1107 <fo:basic-link internal-destination="{$otherterm}"
1108 xsl:use-attribute-sets="xref.properties">
1109 <xsl:apply-templates select="$target" mode="xref-to"/>
1112 <xsl:when test="$xlink">
1113 <xsl:call-template name="simple.xlink">
1114 <xsl:with-param name="content">
1115 <xsl:apply-templates/>
1117 </xsl:call-template>
1119 <xsl:when test="$otherterm != '' and not($target)">
1121 <xsl:text>Warning: glossseealso @otherterm reference not found: </xsl:text>
1122 <xsl:value-of select="$otherterm"/>
1124 <xsl:apply-templates mode="glossary.as.blocks"/>
1127 <xsl:apply-templates mode="glossary.as.blocks"/>
1132 <xsl:when test="position() = last()"/>
1134 <xsl:call-template name="gentext.template">
1135 <xsl:with-param name="context" select="'glossary'"/>
1136 <xsl:with-param name="name" select="'seealso-separator'"/>
1137 </xsl:call-template>
1142 <!-- ==================================================================== -->