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:d="http://docbook.org/ns/docbook"
8 xmlns:fo="http://www.w3.org/1999/XSL/Format"
9 xmlns:xlink='http://www.w3.org/1999/xlink'
10 exclude-result-prefixes="xlink d"
13 <!-- ********************************************************************
15 This file is part of the XSL DocBook Stylesheet distribution.
16 See ../README or http://cdn.docbook.org/release/xsl/current/ for
17 copyright and other information.
19 ******************************************************************** -->
21 <!-- ==================================================================== -->
23 <xsl:template match="d:glossary">
24 <xsl:call-template name="make-glossary"/>
27 <xsl:template match="d:glossdiv/d:title"/>
28 <xsl:template match="d:glossdiv/d:subtitle"/>
29 <xsl:template match="d:glossdiv/d:titleabbrev"/>
31 <!-- ==================================================================== -->
33 <xsl:template name="make-glossary">
34 <xsl:param name="divs" select="d:glossdiv"/>
35 <xsl:param name="entries" select="d:glossentry"/>
36 <xsl:param name="preamble" select="*[not(self::d:title
39 or self::d:glossentry)]"/>
41 &setup-language-variable;
43 <xsl:variable name="id">
44 <xsl:call-template name="object.id"/>
47 <xsl:variable name="presentation">
48 <xsl:call-template name="pi.dbfo_glossary-presentation"/>
51 <xsl:variable name="term-width">
52 <xsl:call-template name="pi.dbfo_glossterm-width"/>
55 <xsl:variable name="width">
57 <xsl:when test="$term-width = ''">
58 <xsl:value-of select="$glossterm.width"/>
61 <xsl:value-of select="$term-width"/>
67 <xsl:call-template name="glossary.titlepage"/>
70 <xsl:if test="$preamble">
71 <xsl:apply-templates select="$preamble"/>
75 <xsl:when test="$presentation = 'list'">
76 <xsl:apply-templates select="$divs" mode="glossary.as.list">
77 <xsl:with-param name="width" select="$width"/>
78 </xsl:apply-templates>
79 <xsl:if test="$entries">
80 <fo:list-block provisional-distance-between-starts="{$width}"
81 provisional-label-separation="{$glossterm.separation}"
82 xsl:use-attribute-sets="normal.para.spacing">
84 <xsl:when test="$glossary.sort != 0">
85 <xsl:apply-templates select="$entries" mode="glossary.as.list">
86 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, d:glossterm[not(parent::d:glossentry/@sortas) or parent::d:glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
87 </xsl:apply-templates>
90 <xsl:apply-templates select="$entries" mode="glossary.as.list"/>
96 <xsl:when test="$presentation = 'blocks'">
97 <xsl:apply-templates select="$divs" mode="glossary.as.blocks"/>
99 <xsl:when test="$glossary.sort != 0">
100 <xsl:apply-templates select="$entries" mode="glossary.as.blocks">
101 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, d:glossterm[not(parent::d:glossentry/@sortas) or parent::d:glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
102 </xsl:apply-templates>
105 <xsl:apply-templates select="$entries" mode="glossary.as.blocks"/>
109 <xsl:when test="$glossary.as.blocks != 0">
110 <xsl:apply-templates select="$divs" mode="glossary.as.blocks"/>
112 <xsl:when test="$glossary.sort != 0">
113 <xsl:apply-templates select="$entries" mode="glossary.as.blocks">
114 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, d:glossterm[not(parent::d:glossentry/@sortas) or parent::d:glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
115 </xsl:apply-templates>
118 <xsl:apply-templates select="$entries" mode="glossary.as.blocks"/>
123 <xsl:apply-templates select="$divs" mode="glossary.as.list">
124 <xsl:with-param name="width" select="$width"/>
125 </xsl:apply-templates>
126 <xsl:if test="$entries">
127 <fo:list-block provisional-distance-between-starts="{$width}"
128 provisional-label-separation="{$glossterm.separation}"
129 xsl:use-attribute-sets="normal.para.spacing">
131 <xsl:when test="$glossary.sort != 0">
132 <xsl:apply-templates select="$entries" mode="glossary.as.list">
133 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, d:glossterm[not(parent::d:glossentry/@sortas) or parent::d:glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
134 </xsl:apply-templates>
137 <xsl:apply-templates select="$entries" mode="glossary.as.list"/>
146 <xsl:template match="d:book/d:glossary|d:part/d:glossary|/d:glossary" priority="2">
147 <xsl:variable name="id">
148 <xsl:call-template name="object.id"/>
151 <xsl:variable name="master-reference">
152 <xsl:call-template name="select.pagemaster"/>
155 <fo:page-sequence hyphenate="{$hyphenate}"
156 master-reference="{$master-reference}">
157 <xsl:attribute name="language">
158 <xsl:call-template name="l10n.language"/>
161 <xsl:attribute name="format">
162 <xsl:call-template name="page.number.format">
163 <xsl:with-param name="master-reference" select="$master-reference"/>
167 <xsl:attribute name="initial-page-number">
168 <xsl:call-template name="initial.page.number">
169 <xsl:with-param name="master-reference" select="$master-reference"/>
173 <xsl:attribute name="force-page-count">
174 <xsl:call-template name="force.page.count">
175 <xsl:with-param name="master-reference" select="$master-reference"/>
179 <xsl:attribute name="hyphenation-character">
180 <xsl:call-template name="gentext">
181 <xsl:with-param name="key" select="'hyphenation-character'"/>
184 <xsl:attribute name="hyphenation-push-character-count">
185 <xsl:call-template name="gentext">
186 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
189 <xsl:attribute name="hyphenation-remain-character-count">
190 <xsl:call-template name="gentext">
191 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
195 <xsl:apply-templates select="." mode="running.head.mode">
196 <xsl:with-param name="master-reference" select="$master-reference"/>
197 </xsl:apply-templates>
198 <xsl:apply-templates select="." mode="running.foot.mode">
199 <xsl:with-param name="master-reference" select="$master-reference"/>
200 </xsl:apply-templates>
202 <fo:flow flow-name="xsl-region-body">
203 <xsl:call-template name="set.flow.properties">
204 <xsl:with-param name="element" select="local-name(.)"/>
205 <xsl:with-param name="master-reference" select="$master-reference"/>
208 <xsl:call-template name="make-glossary"/>
213 <xsl:template match="d:glossary/d:glossaryinfo"></xsl:template>
214 <xsl:template match="d:glossary/d:info"></xsl:template>
215 <xsl:template match="d:glossary/d:title"></xsl:template>
216 <xsl:template match="d:glossary/d:subtitle"></xsl:template>
217 <xsl:template match="d:glossary/d:titleabbrev"></xsl:template>
219 <!-- ==================================================================== -->
221 <xsl:template match="d:glosslist">
222 &setup-language-variable;
224 <xsl:variable name="presentation">
225 <xsl:call-template name="pi.dbfo_glosslist-presentation"/>
228 <xsl:variable name="term-width">
229 <xsl:call-template name="pi.dbfo_glossterm-width"/>
232 <xsl:variable name="width">
234 <xsl:when test="$term-width = ''">
235 <xsl:value-of select="$glossterm.width"/>
238 <xsl:value-of select="$term-width"/>
243 <xsl:if test="d:title or d:info/d:title">
244 <xsl:apply-templates select="(d:title|d:info/d:title)[1]" mode="list.title.mode"/>
248 <xsl:when test="$presentation = 'list'">
249 <fo:list-block provisional-distance-between-starts="{$width}"
250 provisional-label-separation="{$glossterm.separation}"
251 xsl:use-attribute-sets="normal.para.spacing">
253 <xsl:when test="$glossary.sort != 0">
254 <xsl:apply-templates select="d:glossentry" mode="glossary.as.list">
255 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, d:glossterm[not(parent::d:glossentry/@sortas) or parent::d:glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
256 </xsl:apply-templates>
259 <xsl:apply-templates select="d:glossentry" mode="glossary.as.list"/>
264 <xsl:when test="$presentation = 'blocks'">
266 <xsl:when test="$glossary.sort != 0">
267 <xsl:apply-templates select="d:glossentry" mode="glossary.as.blocks">
268 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, d:glossterm[not(parent::d:glossentry/@sortas) or parent::d:glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
269 </xsl:apply-templates>
272 <xsl:apply-templates select="d:glossentry" mode="glossary.as.blocks"/>
276 <xsl:when test="$glosslist.as.blocks != 0">
278 <xsl:when test="$glossary.sort != 0">
279 <xsl:apply-templates select="d:glossentry" mode="glossary.as.blocks">
280 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, d:glossterm[not(parent::d:glossentry/@sortas) or parent::d:glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
281 </xsl:apply-templates>
284 <xsl:apply-templates select="d:glossentry" mode="glossary.as.blocks"/>
289 <fo:list-block provisional-distance-between-starts="{$width}"
290 provisional-label-separation="{$glossterm.separation}"
291 xsl:use-attribute-sets="normal.para.spacing">
293 <xsl:when test="$glossary.sort != 0">
294 <xsl:apply-templates select="d:glossentry" mode="glossary.as.list">
295 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, d:glossterm[not(parent::d:glossentry/@sortas) or parent::d:glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
296 </xsl:apply-templates>
299 <xsl:apply-templates select="d:glossentry" mode="glossary.as.list"/>
307 <!-- ==================================================================== -->
308 <!-- Glossary collection -->
310 <xsl:template match="d:glossary[@role='auto']" priority="2">
311 <xsl:variable name="collection" select="document($glossary.collection, .)"/>
312 <xsl:if test="$glossary.collection = ''">
314 <xsl:text>Warning: processing automatic glossary </xsl:text>
315 <xsl:text>without a glossary.collection file.</xsl:text>
319 <xsl:if test="not($collection) and $glossary.collection != ''">
321 <xsl:text>Warning: processing automatic glossary but unable to </xsl:text>
322 <xsl:text>open glossary.collection file '</xsl:text>
323 <xsl:value-of select="$glossary.collection"/>
324 <xsl:text>'</xsl:text>
328 <xsl:call-template name="make-auto-glossary"/>
331 <xsl:template name="make-auto-glossary">
332 <xsl:param name="collection" select="document($glossary.collection, .)"/>
333 <xsl:param name="terms" select="//d:glossterm[not(parent::d:glossdef)]|//d:firstterm"/>
334 <xsl:param name="preamble" select="*[not(self::d:title
337 or self::d:glossentry)]"/>
339 &setup-language-variable;
341 <xsl:variable name="id">
342 <xsl:call-template name="object.id"/>
345 <xsl:variable name="presentation">
346 <xsl:call-template name="pi.dbfo_glossary-presentation"/>
349 <xsl:variable name="term-width">
350 <xsl:call-template name="pi.dbfo_glossterm-width"/>
353 <xsl:variable name="width">
355 <xsl:when test="$term-width = ''">
356 <xsl:value-of select="$glossterm.width"/>
359 <xsl:value-of select="$term-width"/>
364 <xsl:if test="$glossary.collection = ''">
366 <xsl:text>Warning: processing automatic glossary </xsl:text>
367 <xsl:text>without a glossary.collection file.</xsl:text>
371 <fo:block id="{$id}">
372 <xsl:call-template name="glossary.titlepage"/>
375 <xsl:if test="$preamble">
376 <xsl:apply-templates select="$preamble"/>
380 <xsl:when test="d:glossdiv and $collection//d:glossdiv">
381 <xsl:for-each select="$collection//d:glossdiv">
382 <!-- first see if there are any in this div -->
383 <xsl:variable name="exist.test">
384 <xsl:for-each select="d:glossentry">
385 <xsl:variable name="cterm" select="d:glossterm"/>
386 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
387 <xsl:value-of select="d:glossterm"/>
392 <xsl:if test="$exist.test != ''">
394 <xsl:when test="$presentation = 'list'">
395 <xsl:apply-templates select="." mode="auto-glossary-as-list">
396 <xsl:with-param name="width" select="$width"/>
397 <xsl:with-param name="terms" select="$terms"/>
398 </xsl:apply-templates>
400 <xsl:when test="$presentation = 'blocks'">
401 <xsl:apply-templates select="." mode="auto-glossary-as-blocks">
402 <xsl:with-param name="terms" select="$terms"/>
403 </xsl:apply-templates>
405 <xsl:when test="$glossary.as.blocks != 0">
406 <xsl:apply-templates select="." mode="auto-glossary-as-blocks">
407 <xsl:with-param name="terms" select="$terms"/>
408 </xsl:apply-templates>
411 <xsl:apply-templates select="." mode="auto-glossary-as-list">
412 <xsl:with-param name="width" select="$width"/>
413 <xsl:with-param name="terms" select="$terms"/>
414 </xsl:apply-templates>
422 <xsl:when test="$presentation = 'list'">
423 <fo:list-block provisional-distance-between-starts="{$width}"
424 provisional-label-separation="{$glossterm.separation}"
425 xsl:use-attribute-sets="normal.para.spacing">
427 <xsl:when test="$glossary.sort != 0">
428 <xsl:for-each select="$collection//d:glossentry">
429 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, d:glossterm[not(parent::d:glossentry/@sortas) or parent::d:glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
430 <xsl:variable name="cterm" select="d:glossterm"/>
431 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
432 <xsl:apply-templates select="."
433 mode="auto-glossary-as-list"/>
438 <xsl:for-each select="$collection//d:glossentry">
439 <xsl:variable name="cterm" select="d:glossterm"/>
440 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
441 <xsl:apply-templates select="."
442 mode="auto-glossary-as-list"/>
449 <xsl:when test="$presentation = 'blocks' or
450 $glossary.as.blocks != 0">
452 <xsl:when test="$glossary.sort != 0">
453 <xsl:for-each select="$collection//d:glossentry">
454 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, d:glossterm[not(parent::d:glossentry/@sortas) or parent::d:glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
455 <xsl:variable name="cterm" select="d:glossterm"/>
456 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
457 <xsl:apply-templates select="."
458 mode="auto-glossary-as-blocks"/>
463 <xsl:for-each select="$collection//d:glossentry">
464 <xsl:variable name="cterm" select="d:glossterm"/>
465 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
466 <xsl:apply-templates select="."
467 mode="auto-glossary-as-blocks"/>
474 <fo:list-block provisional-distance-between-starts="{$width}"
475 provisional-label-separation="{$glossterm.separation}"
476 xsl:use-attribute-sets="normal.para.spacing">
478 <xsl:when test="$glossary.sort != 0">
479 <xsl:for-each select="$collection//d:glossentry">
481 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, d:glossterm[not(parent::d:glossentry/@sortas) or parent::d:glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
482 <xsl:variable name="cterm" select="d:glossterm"/>
483 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
484 <xsl:apply-templates select="."
485 mode="auto-glossary-as-list"/>
490 <xsl:for-each select="$collection//d:glossentry">
491 <xsl:variable name="cterm" select="d:glossterm"/>
492 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
493 <xsl:apply-templates select="."
494 mode="auto-glossary-as-list"/>
506 <xsl:template match="d:book/d:glossary[@role='auto']|
507 d:part/d:glossary[@role='auto']|
508 /d:glossary[@role='auto']" priority="2.5">
509 <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
511 <xsl:variable name="master-reference">
512 <xsl:call-template name="select.pagemaster"/>
515 <xsl:if test="$glossary.collection = ''">
517 <xsl:text>Warning: processing automatic glossary </xsl:text>
518 <xsl:text>without a glossary.collection file.</xsl:text>
522 <fo:page-sequence hyphenate="{$hyphenate}"
523 master-reference="{$master-reference}">
524 <xsl:attribute name="language">
525 <xsl:call-template name="l10n.language"/>
527 <xsl:attribute name="format">
528 <xsl:call-template name="page.number.format">
529 <xsl:with-param name="master-reference" select="$master-reference"/>
533 <xsl:attribute name="initial-page-number">
534 <xsl:call-template name="initial.page.number">
535 <xsl:with-param name="master-reference" select="$master-reference"/>
539 <xsl:attribute name="force-page-count">
540 <xsl:call-template name="force.page.count">
541 <xsl:with-param name="master-reference" select="$master-reference"/>
545 <xsl:attribute name="hyphenation-character">
546 <xsl:call-template name="gentext">
547 <xsl:with-param name="key" select="'hyphenation-character'"/>
550 <xsl:attribute name="hyphenation-push-character-count">
551 <xsl:call-template name="gentext">
552 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
555 <xsl:attribute name="hyphenation-remain-character-count">
556 <xsl:call-template name="gentext">
557 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
561 <xsl:apply-templates select="." mode="running.head.mode">
562 <xsl:with-param name="master-reference" select="$master-reference"/>
563 </xsl:apply-templates>
564 <xsl:apply-templates select="." mode="running.foot.mode">
565 <xsl:with-param name="master-reference" select="$master-reference"/>
566 </xsl:apply-templates>
568 <fo:flow flow-name="xsl-region-body">
569 <xsl:call-template name="set.flow.properties">
570 <xsl:with-param name="element" select="local-name(.)"/>
571 <xsl:with-param name="master-reference" select="$master-reference"/>
574 <xsl:call-template name="make-auto-glossary"/>
579 <xsl:template match="d:glossdiv" mode="auto-glossary-as-list">
580 <xsl:param name="width" select="$glossterm.width"/>
581 <xsl:param name="terms" select="."/>
583 &setup-language-variable;
585 <xsl:variable name="id">
586 <xsl:call-template name="object.id"/>
589 <xsl:variable name="preamble"
590 select="*[not(self::d:title
592 or self::d:glossentry)]"/>
594 <fo:block id="{$id}">
595 <xsl:call-template name="glossdiv.titlepage"/>
598 <xsl:apply-templates select="$preamble"/>
600 <fo:list-block provisional-distance-between-starts="{$width}"
601 provisional-label-separation="{$glossterm.separation}"
602 xsl:use-attribute-sets="normal.para.spacing">
604 <xsl:when test="$glossary.sort != 0">
605 <xsl:for-each select="d:glossentry">
606 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, d:glossterm[not(parent::d:glossentry/@sortas) or parent::d:glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
607 <xsl:variable name="cterm" select="d:glossterm"/>
608 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
609 <xsl:apply-templates select="." mode="auto-glossary-as-list"/>
614 <xsl:for-each select="d:glossentry">
615 <xsl:variable name="cterm" select="d:glossterm"/>
616 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
617 <xsl:apply-templates select="." mode="auto-glossary-as-list"/>
625 <xsl:template match="d:glossentry" mode="auto-glossary-as-list">
626 <xsl:apply-templates select="." mode="glossary.as.list"/>
629 <xsl:template match="d:glossdiv" mode="auto-glossary-as-blocks">
630 <xsl:param name="terms" select="."/>
632 &setup-language-variable;
634 <xsl:variable name="id">
635 <xsl:call-template name="object.id"/>
638 <xsl:variable name="preamble"
639 select="*[not(self::d:title
641 or self::d:glossentry)]"/>
643 <fo:block id="{$id}">
644 <xsl:call-template name="glossdiv.titlepage"/>
647 <xsl:apply-templates select="$preamble"/>
650 <xsl:when test="$glossary.sort != 0">
651 <xsl:for-each select="d:glossentry">
652 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, d:glossterm[not(parent::d:glossentry/@sortas) or parent::d:glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
653 <xsl:variable name="cterm" select="d:glossterm"/>
654 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
655 <xsl:apply-templates select="." mode="auto-glossary-as-blocks"/>
660 <xsl:for-each select="d:glossentry">
661 <xsl:variable name="cterm" select="d:glossterm"/>
662 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
663 <xsl:apply-templates select="." mode="auto-glossary-as-blocks"/>
671 <xsl:template match="d:glossentry" mode="auto-glossary-as-blocks">
672 <xsl:apply-templates select="." mode="glossary.as.blocks"/>
675 <!-- ==================================================================== -->
676 <!-- Format glossary as a list -->
678 <xsl:template match="d:glossdiv" mode="glossary.as.list">
679 <xsl:param name="width" select="$glossterm.width"/>
681 &setup-language-variable;
683 <xsl:variable name="id">
684 <xsl:call-template name="object.id"/>
687 <xsl:variable name="entries" select="d:glossentry"/>
689 <xsl:variable name="preamble"
690 select="*[not(self::d:title
692 or self::d:glossentry)]"/>
694 <fo:block id="{$id}">
695 <xsl:call-template name="glossdiv.titlepage"/>
698 <xsl:apply-templates select="$preamble"/>
700 <fo:list-block provisional-distance-between-starts="{$width}"
701 provisional-label-separation="{$glossterm.separation}"
702 xsl:use-attribute-sets="normal.para.spacing">
704 <xsl:when test="$glossary.sort != 0">
705 <xsl:apply-templates select="$entries" mode="glossary.as.list">
706 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, d:glossterm[not(parent::d:glossentry/@sortas) or parent::d:glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
707 </xsl:apply-templates>
710 <xsl:apply-templates select="$entries" mode="glossary.as.list"/>
718 GlossTerm, Acronym?, Abbrev?,
721 (GlossSee | GlossDef+)
724 <xsl:template match="d:glossentry" mode="glossary.as.list">
725 <xsl:variable name="id">
726 <xsl:call-template name="object.id"/>
729 <fo:list-item xsl:use-attribute-sets="glossentry.list.item.properties">
730 <xsl:call-template name="anchor">
731 <xsl:with-param name="conditional">
733 <xsl:when test="$glossterm.auto.link != 0
734 or $glossary.collection != ''">0</xsl:when>
735 <xsl:otherwise>1</xsl:otherwise>
740 <fo:list-item-label end-indent="label-end()">
741 <fo:block xsl:use-attribute-sets="glossterm.list.properties">
743 <xsl:when test="$glossentry.show.acronym = 'primary'">
745 <xsl:when test="d:acronym|d:abbrev">
746 <xsl:apply-templates select="d:acronym|d:abbrev"
747 mode="glossary.as.list"/>
748 <xsl:text> (</xsl:text>
749 <xsl:apply-templates select="d:glossterm"
750 mode="glossary.as.list"/>
751 <xsl:text>)</xsl:text>
754 <xsl:apply-templates select="d:glossterm"
755 mode="glossary.as.list"/>
760 <xsl:when test="$glossentry.show.acronym = 'yes'">
761 <xsl:apply-templates select="d:glossterm" mode="glossary.as.list"/>
763 <xsl:if test="d:acronym|d:abbrev">
764 <xsl:text> (</xsl:text>
765 <xsl:apply-templates select="d:acronym|d:abbrev"
766 mode="glossary.as.list"/>
767 <xsl:text>)</xsl:text>
772 <xsl:apply-templates select="d:glossterm" mode="glossary.as.list"/>
775 <xsl:apply-templates select="d:indexterm"/>
777 </fo:list-item-label>
779 <fo:list-item-body start-indent="body-start()">
780 <fo:block xsl:use-attribute-sets="glossdef.list.properties">
781 <xsl:apply-templates select="d:glosssee|d:glossdef" mode="glossary.as.list"/>
787 <xsl:template match="d:glossentry/d:glossterm" mode="glossary.as.list">
788 <xsl:variable name="id">
789 <xsl:call-template name="object.id"/>
791 <fo:inline id="{$id}">
792 <xsl:apply-templates/>
794 <xsl:if test="following-sibling::d:glossterm">, </xsl:if>
797 <xsl:template match="d:glossentry/d:acronym" mode="glossary.as.list">
798 <xsl:apply-templates/>
799 <xsl:if test="following-sibling::d:acronym|following-sibling::d:abbrev">, </xsl:if>
802 <xsl:template match="d:glossentry/d:abbrev" mode="glossary.as.list">
803 <xsl:apply-templates/>
804 <xsl:if test="following-sibling::d:acronym|following-sibling::d:abbrev">, </xsl:if>
807 <xsl:template match="d:glossentry/d:revhistory" mode="glossary.as.list">
810 <xsl:template match="d:glossentry/d:glosssee" mode="glossary.as.list">
811 <xsl:variable name="otherterm" select="@otherterm"/>
812 <xsl:variable name="targets" select="key('id', $otherterm)"/>
813 <xsl:variable name="target" select="$targets[1]"/>
814 <xsl:variable name="xlink" select="@xlink:href"/>
817 <xsl:variable name="template">
818 <xsl:call-template name="gentext.template">
819 <xsl:with-param name="context" select="'glossary'"/>
820 <xsl:with-param name="name" select="'see'"/>
823 <xsl:variable name="title">
825 <xsl:when test="$target">
826 <fo:basic-link internal-destination="{$otherterm}"
827 xsl:use-attribute-sets="xref.properties">
828 <xsl:apply-templates select="$target" mode="xref-to"/>
831 <xsl:when test="$xlink">
832 <xsl:call-template name="simple.xlink">
833 <xsl:with-param name="content">
834 <xsl:apply-templates/>
838 <xsl:when test="$otherterm != '' and not($target)">
840 <xsl:text>Warning: glosssee @otherterm reference not found: </xsl:text>
841 <xsl:value-of select="$otherterm"/>
843 <xsl:apply-templates mode="glossary.as.list"/>
846 <xsl:apply-templates mode="glossary.as.list"/>
850 <xsl:call-template name="substitute-markup">
851 <xsl:with-param name="template" select="$template"/>
852 <xsl:with-param name="title" select="$title"/>
857 <xsl:template match="d:glossentry/d:glossdef" mode="glossary.as.list">
858 <xsl:apply-templates select="*[local-name(.) != 'glossseealso']"/>
859 <xsl:if test="d:glossseealso">
861 <xsl:variable name="template">
862 <xsl:call-template name="gentext.template">
863 <xsl:with-param name="context" select="'glossary'"/>
864 <xsl:with-param name="name" select="'seealso'"/>
867 <xsl:variable name="title">
868 <xsl:apply-templates select="d:glossseealso" mode="glossary.as.list"/>
870 <xsl:call-template name="substitute-markup">
871 <xsl:with-param name="template" select="$template"/>
872 <xsl:with-param name="title" select="$title"/>
878 <xsl:template match="d:glossentry/d:glossdef/d:para[1]|d:glossentry/d:glossdef/d:simpara[1]"
879 mode="glossary.as.list">
881 <xsl:apply-templates/>
885 <xsl:template match="d:glossseealso" mode="glossary.as.list">
886 <xsl:variable name="otherterm" select="@otherterm"/>
887 <xsl:variable name="targets" select="key('id', $otherterm)"/>
888 <xsl:variable name="target" select="$targets[1]"/>
889 <xsl:variable name="xlink" select="@xlink:href"/>
892 <xsl:when test="$target">
893 <fo:basic-link internal-destination="{$otherterm}"
894 xsl:use-attribute-sets="xref.properties">
895 <xsl:apply-templates select="$target" mode="xref-to"/>
898 <xsl:when test="$xlink">
899 <xsl:call-template name="simple.xlink">
900 <xsl:with-param name="content">
901 <xsl:apply-templates/>
905 <xsl:when test="$otherterm != '' and not($target)">
907 <xsl:text>Warning: glossseealso @otherterm reference not found: </xsl:text>
908 <xsl:value-of select="$otherterm"/>
910 <xsl:apply-templates mode="glossary.as.list"/>
913 <xsl:apply-templates mode="glossary.as.list"/>
918 <xsl:when test="position() = last()"/>
920 <xsl:call-template name="gentext.template">
921 <xsl:with-param name="context" select="'glossary'"/>
922 <xsl:with-param name="name" select="'seealso-separator'"/>
928 <!-- ==================================================================== -->
929 <!-- Format glossary blocks -->
931 <xsl:template match="d:glossdiv" mode="glossary.as.blocks">
932 &setup-language-variable;
934 <xsl:variable name="id">
935 <xsl:call-template name="object.id"/>
938 <xsl:variable name="entries" select="d:glossentry"/>
939 <xsl:variable name="preamble"
940 select="*[not(self::d:title
942 or self::d:glossentry)]"/>
944 <fo:block id="{$id}">
945 <xsl:call-template name="glossdiv.titlepage"/>
948 <xsl:apply-templates select="$preamble"/>
951 <xsl:when test="$glossary.sort != 0">
952 <xsl:apply-templates select="$entries" mode="glossary.as.blocks">
953 <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, d:glossterm[not(parent::d:glossentry/@sortas) or parent::d:glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
954 </xsl:apply-templates>
957 <xsl:apply-templates select="$entries" mode="glossary.as.blocks"/>
964 GlossTerm, Acronym?, Abbrev?,
967 (GlossSee | GlossDef+)
970 <xsl:template match="d:glossentry" mode="glossary.as.blocks">
971 <xsl:variable name="id">
972 <xsl:call-template name="object.id"/>
975 <fo:block xsl:use-attribute-sets="glossterm.block.properties">
976 <xsl:call-template name="anchor">
977 <xsl:with-param name="conditional">
979 <xsl:when test="$glossterm.auto.link != 0
980 or $glossary.collection != ''">0</xsl:when>
981 <xsl:otherwise>1</xsl:otherwise>
987 <xsl:when test="$glossentry.show.acronym = 'primary'">
989 <xsl:when test="d:acronym|d:abbrev">
990 <xsl:apply-templates select="d:acronym|d:abbrev" mode="glossary.as.blocks"/>
991 <xsl:text> (</xsl:text>
992 <xsl:apply-templates select="d:glossterm" mode="glossary.as.blocks"/>
993 <xsl:text>)</xsl:text>
996 <xsl:apply-templates select="d:glossterm" mode="glossary.as.blocks"/>
1001 <xsl:when test="$glossentry.show.acronym = 'yes'">
1002 <xsl:apply-templates select="d:glossterm" mode="glossary.as.blocks"/>
1004 <xsl:if test="d:acronym|d:abbrev">
1005 <xsl:text> (</xsl:text>
1006 <xsl:apply-templates select="d:acronym|d:abbrev" mode="glossary.as.blocks"/>
1007 <xsl:text>)</xsl:text>
1012 <xsl:apply-templates select="d:glossterm" mode="glossary.as.blocks"/>
1016 <xsl:apply-templates select="d:indexterm"/>
1019 <fo:block xsl:use-attribute-sets="glossdef.block.properties">
1020 <xsl:apply-templates select="d:glosssee|d:glossdef" mode="glossary.as.blocks"/>
1024 <xsl:template match="d:glossentry/d:glossterm" mode="glossary.as.blocks">
1025 <xsl:variable name="id">
1026 <xsl:call-template name="object.id"/>
1028 <fo:inline id="{$id}">
1029 <xsl:apply-templates/>
1031 <xsl:if test="following-sibling::d:glossterm">, </xsl:if>
1034 <xsl:template match="d:glossentry/d:acronym" mode="glossary.as.blocks">
1035 <xsl:apply-templates/>
1036 <xsl:if test="following-sibling::d:acronym|following-sibling::d:abbrev">, </xsl:if>
1039 <xsl:template match="d:glossentry/d:abbrev" mode="glossary.as.blocks">
1040 <xsl:apply-templates/>
1041 <xsl:if test="following-sibling::d:acronym|following-sibling::d:abbrev">, </xsl:if>
1044 <xsl:template match="d:glossentry/d:glosssee" mode="glossary.as.blocks">
1045 <xsl:variable name="otherterm" select="@otherterm"/>
1046 <xsl:variable name="targets" select="key('id', $otherterm)"/>
1047 <xsl:variable name="target" select="$targets[1]"/>
1048 <xsl:variable name="xlink" select="@xlink:href"/>
1050 <xsl:variable name="template">
1051 <xsl:call-template name="gentext.template">
1052 <xsl:with-param name="context" select="'glossary'"/>
1053 <xsl:with-param name="name" select="'see'"/>
1054 </xsl:call-template>
1056 <xsl:variable name="title">
1058 <xsl:when test="$target">
1059 <fo:basic-link internal-destination="{$otherterm}"
1060 xsl:use-attribute-sets="xref.properties">
1061 <xsl:apply-templates select="$target" mode="xref-to"/>
1064 <xsl:when test="$xlink">
1065 <xsl:call-template name="simple.xlink">
1066 <xsl:with-param name="content">
1067 <xsl:apply-templates/>
1069 </xsl:call-template>
1071 <xsl:when test="$otherterm != '' and not($target)">
1073 <xsl:text>Warning: glosssee @otherterm reference not found: </xsl:text>
1074 <xsl:value-of select="$otherterm"/>
1076 <xsl:apply-templates mode="glossary.as.blocks"/>
1079 <xsl:apply-templates mode="glossary.as.blocks"/>
1083 <xsl:call-template name="substitute-markup">
1084 <xsl:with-param name="template" select="$template"/>
1085 <xsl:with-param name="title" select="$title"/>
1086 </xsl:call-template>
1089 <xsl:template match="d:glossentry/d:glossdef" mode="glossary.as.blocks">
1090 <xsl:apply-templates select="*[local-name(.) != 'glossseealso']"
1091 mode="glossary.as.blocks"/>
1092 <xsl:if test="d:glossseealso">
1094 <xsl:variable name="template">
1095 <xsl:call-template name="gentext.template">
1096 <xsl:with-param name="context" select="'glossary'"/>
1097 <xsl:with-param name="name" select="'seealso'"/>
1098 </xsl:call-template>
1100 <xsl:variable name="title">
1101 <xsl:apply-templates select="d:glossseealso" mode="glossary.as.blocks"/>
1103 <xsl:call-template name="substitute-markup">
1104 <xsl:with-param name="template" select="$template"/>
1105 <xsl:with-param name="title" select="$title"/>
1106 </xsl:call-template>
1111 <xsl:template match="d:glossentry/d:glossdef/d:para[1]|d:glossentry/d:glossdef/d:simpara[1]"
1112 mode="glossary.as.blocks">
1114 <xsl:apply-templates/>
1118 <!-- Handle any other glossdef content normally -->
1119 <xsl:template match="*" mode="glossary.as.blocks">
1120 <xsl:apply-templates select="." />
1123 <xsl:template match="d:glossseealso" mode="glossary.as.blocks">
1124 <xsl:variable name="otherterm" select="@otherterm"/>
1125 <xsl:variable name="targets" select="key('id', $otherterm)"/>
1126 <xsl:variable name="target" select="$targets[1]"/>
1127 <xsl:variable name="xlink" select="@xlink:href"/>
1130 <xsl:when test="$target">
1131 <fo:basic-link internal-destination="{$otherterm}"
1132 xsl:use-attribute-sets="xref.properties">
1133 <xsl:apply-templates select="$target" mode="xref-to"/>
1136 <xsl:when test="$xlink">
1137 <xsl:call-template name="simple.xlink">
1138 <xsl:with-param name="content">
1139 <xsl:apply-templates/>
1141 </xsl:call-template>
1143 <xsl:when test="$otherterm != '' and not($target)">
1145 <xsl:text>Warning: glossseealso @otherterm reference not found: </xsl:text>
1146 <xsl:value-of select="$otherterm"/>
1148 <xsl:apply-templates mode="glossary.as.blocks"/>
1151 <xsl:apply-templates mode="glossary.as.blocks"/>
1156 <xsl:when test="position() = last()"/>
1158 <xsl:call-template name="gentext.template">
1159 <xsl:with-param name="context" select="'glossary'"/>
1160 <xsl:with-param name="name" select="'seealso-separator'"/>
1161 </xsl:call-template>
1166 <!-- ==================================================================== -->