| 1 | <?xml version='1.0'?>
|
|---|
| 2 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|---|
| 3 | xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
|---|
| 4 | version='1.0'>
|
|---|
| 5 |
|
|---|
| 6 | <!-- ********************************************************************
|
|---|
| 7 | $Id: glossary.xsl,v 1.30 2005/05/13 17:17:00 bobstayton Exp $
|
|---|
| 8 | ********************************************************************
|
|---|
| 9 |
|
|---|
| 10 | This file is part of the XSL DocBook Stylesheet distribution.
|
|---|
| 11 | See ../README or http://nwalsh.com/docbook/xsl/ for copyright
|
|---|
| 12 | and other information.
|
|---|
| 13 |
|
|---|
| 14 | ******************************************************************** -->
|
|---|
| 15 |
|
|---|
| 16 | <!-- ==================================================================== -->
|
|---|
| 17 |
|
|---|
| 18 | <xsl:template match="glossary">
|
|---|
| 19 | <xsl:call-template name="make-glossary"/>
|
|---|
| 20 | </xsl:template>
|
|---|
| 21 |
|
|---|
| 22 | <xsl:template match="glossdiv/title"/>
|
|---|
| 23 | <xsl:template match="glossdiv/subtitle"/>
|
|---|
| 24 | <xsl:template match="glossdiv/titleabbrev"/>
|
|---|
| 25 |
|
|---|
| 26 | <!-- ==================================================================== -->
|
|---|
| 27 |
|
|---|
| 28 | <xsl:template name="make-glossary">
|
|---|
| 29 | <xsl:param name="divs" select="glossdiv"/>
|
|---|
| 30 | <xsl:param name="entries" select="glossentry"/>
|
|---|
| 31 | <xsl:param name="preamble" select="*[not(self::title
|
|---|
| 32 | or self::subtitle
|
|---|
| 33 | or self::glossdiv
|
|---|
| 34 | or self::glossentry)]"/>
|
|---|
| 35 |
|
|---|
| 36 | <xsl:variable name="id">
|
|---|
| 37 | <xsl:call-template name="object.id"/>
|
|---|
| 38 | </xsl:variable>
|
|---|
| 39 |
|
|---|
| 40 | <xsl:variable name="presentation">
|
|---|
| 41 | <xsl:call-template name="dbfo-attribute">
|
|---|
| 42 | <xsl:with-param name="pis"
|
|---|
| 43 | select="processing-instruction('dbfo')"/>
|
|---|
| 44 | <xsl:with-param name="attribute" select="'glossary-presentation'"/>
|
|---|
| 45 | </xsl:call-template>
|
|---|
| 46 | </xsl:variable>
|
|---|
| 47 |
|
|---|
| 48 | <xsl:variable name="term-width">
|
|---|
| 49 | <xsl:call-template name="dbfo-attribute">
|
|---|
| 50 | <xsl:with-param name="pis"
|
|---|
| 51 | select="processing-instruction('dbfo')"/>
|
|---|
| 52 | <xsl:with-param name="attribute" select="'glossterm-width'"/>
|
|---|
| 53 | </xsl:call-template>
|
|---|
| 54 | </xsl:variable>
|
|---|
| 55 |
|
|---|
| 56 | <xsl:variable name="width">
|
|---|
| 57 | <xsl:choose>
|
|---|
| 58 | <xsl:when test="$term-width = ''">
|
|---|
| 59 | <xsl:value-of select="$glossterm.width"/>
|
|---|
| 60 | </xsl:when>
|
|---|
| 61 | <xsl:otherwise>
|
|---|
| 62 | <xsl:value-of select="$term-width"/>
|
|---|
| 63 | </xsl:otherwise>
|
|---|
| 64 | </xsl:choose>
|
|---|
| 65 | </xsl:variable>
|
|---|
| 66 |
|
|---|
| 67 | <fo:block id="{$id}">
|
|---|
| 68 | <xsl:call-template name="glossary.titlepage"/>
|
|---|
| 69 | </fo:block>
|
|---|
| 70 |
|
|---|
| 71 | <xsl:if test="$preamble">
|
|---|
| 72 | <xsl:apply-templates select="$preamble"/>
|
|---|
| 73 | </xsl:if>
|
|---|
| 74 |
|
|---|
| 75 | <xsl:choose>
|
|---|
| 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">
|
|---|
| 84 | <xsl:apply-templates select="$entries" mode="glossary.as.list"/>
|
|---|
| 85 | </fo:list-block>
|
|---|
| 86 | </xsl:if>
|
|---|
| 87 | </xsl:when>
|
|---|
| 88 | <xsl:when test="$presentation = 'blocks'">
|
|---|
| 89 | <xsl:apply-templates select="$divs" mode="glossary.as.blocks"/>
|
|---|
| 90 | <xsl:apply-templates select="$entries" mode="glossary.as.blocks"/>
|
|---|
| 91 | </xsl:when>
|
|---|
| 92 | <xsl:when test="$glossary.as.blocks != 0">
|
|---|
| 93 | <xsl:apply-templates select="$divs" mode="glossary.as.blocks"/>
|
|---|
| 94 | <xsl:apply-templates select="$entries" mode="glossary.as.blocks"/>
|
|---|
| 95 | </xsl:when>
|
|---|
| 96 | <xsl:otherwise>
|
|---|
| 97 | <xsl:apply-templates select="$divs" mode="glossary.as.list">
|
|---|
| 98 | <xsl:with-param name="width" select="$width"/>
|
|---|
| 99 | </xsl:apply-templates>
|
|---|
| 100 | <xsl:if test="$entries">
|
|---|
| 101 | <fo:list-block provisional-distance-between-starts="{$width}"
|
|---|
| 102 | provisional-label-separation="{$glossterm.separation}"
|
|---|
| 103 | xsl:use-attribute-sets="normal.para.spacing">
|
|---|
| 104 | <xsl:apply-templates select="$entries" mode="glossary.as.list"/>
|
|---|
| 105 | </fo:list-block>
|
|---|
| 106 | </xsl:if>
|
|---|
| 107 | </xsl:otherwise>
|
|---|
| 108 | </xsl:choose>
|
|---|
| 109 | </xsl:template>
|
|---|
| 110 |
|
|---|
| 111 | <xsl:template match="book/glossary|part/glossary|/glossary" priority="2">
|
|---|
| 112 | <xsl:variable name="id">
|
|---|
| 113 | <xsl:call-template name="object.id"/>
|
|---|
| 114 | </xsl:variable>
|
|---|
| 115 |
|
|---|
| 116 | <xsl:variable name="master-reference">
|
|---|
| 117 | <xsl:call-template name="select.pagemaster"/>
|
|---|
| 118 | </xsl:variable>
|
|---|
| 119 |
|
|---|
| 120 | <fo:page-sequence hyphenate="{$hyphenate}"
|
|---|
| 121 | master-reference="{$master-reference}">
|
|---|
| 122 | <xsl:attribute name="language">
|
|---|
| 123 | <xsl:call-template name="l10n.language"/>
|
|---|
| 124 | </xsl:attribute>
|
|---|
| 125 | <xsl:attribute name="format">
|
|---|
| 126 | <xsl:call-template name="page.number.format">
|
|---|
| 127 | <xsl:with-param name="master-reference" select="$master-reference"/>
|
|---|
| 128 | </xsl:call-template>
|
|---|
| 129 | </xsl:attribute>
|
|---|
| 130 |
|
|---|
| 131 | <xsl:attribute name="initial-page-number">
|
|---|
| 132 | <xsl:call-template name="initial.page.number">
|
|---|
| 133 | <xsl:with-param name="master-reference" select="$master-reference"/>
|
|---|
| 134 | </xsl:call-template>
|
|---|
| 135 | </xsl:attribute>
|
|---|
| 136 |
|
|---|
| 137 | <xsl:attribute name="force-page-count">
|
|---|
| 138 | <xsl:call-template name="force.page.count">
|
|---|
| 139 | <xsl:with-param name="master-reference" select="$master-reference"/>
|
|---|
| 140 | </xsl:call-template>
|
|---|
| 141 | </xsl:attribute>
|
|---|
| 142 |
|
|---|
| 143 | <xsl:attribute name="hyphenation-character">
|
|---|
| 144 | <xsl:call-template name="gentext">
|
|---|
| 145 | <xsl:with-param name="key" select="'hyphenation-character'"/>
|
|---|
| 146 | </xsl:call-template>
|
|---|
| 147 | </xsl:attribute>
|
|---|
| 148 | <xsl:attribute name="hyphenation-push-character-count">
|
|---|
| 149 | <xsl:call-template name="gentext">
|
|---|
| 150 | <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
|
|---|
| 151 | </xsl:call-template>
|
|---|
| 152 | </xsl:attribute>
|
|---|
| 153 | <xsl:attribute name="hyphenation-remain-character-count">
|
|---|
| 154 | <xsl:call-template name="gentext">
|
|---|
| 155 | <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
|
|---|
| 156 | </xsl:call-template>
|
|---|
| 157 | </xsl:attribute>
|
|---|
| 158 |
|
|---|
| 159 | <xsl:apply-templates select="." mode="running.head.mode">
|
|---|
| 160 | <xsl:with-param name="master-reference" select="$master-reference"/>
|
|---|
| 161 | </xsl:apply-templates>
|
|---|
| 162 | <xsl:apply-templates select="." mode="running.foot.mode">
|
|---|
| 163 | <xsl:with-param name="master-reference" select="$master-reference"/>
|
|---|
| 164 | </xsl:apply-templates>
|
|---|
| 165 |
|
|---|
| 166 | <fo:flow flow-name="xsl-region-body">
|
|---|
| 167 | <xsl:call-template name="set.flow.properties">
|
|---|
| 168 | <xsl:with-param name="element" select="local-name(.)"/>
|
|---|
| 169 | <xsl:with-param name="master-reference" select="$master-reference"/>
|
|---|
| 170 | </xsl:call-template>
|
|---|
| 171 |
|
|---|
| 172 | <xsl:call-template name="make-glossary"/>
|
|---|
| 173 | </fo:flow>
|
|---|
| 174 | </fo:page-sequence>
|
|---|
| 175 | </xsl:template>
|
|---|
| 176 |
|
|---|
| 177 | <xsl:template match="glossary/glossaryinfo"></xsl:template>
|
|---|
| 178 | <xsl:template match="glossary/title"></xsl:template>
|
|---|
| 179 | <xsl:template match="glossary/subtitle"></xsl:template>
|
|---|
| 180 | <xsl:template match="glossary/titleabbrev"></xsl:template>
|
|---|
| 181 |
|
|---|
| 182 | <!-- ==================================================================== -->
|
|---|
| 183 |
|
|---|
| 184 | <xsl:template match="glosslist">
|
|---|
| 185 | <xsl:variable name="presentation">
|
|---|
| 186 | <xsl:call-template name="dbfo-attribute">
|
|---|
| 187 | <xsl:with-param name="pis"
|
|---|
| 188 | select="processing-instruction('dbfo')"/>
|
|---|
| 189 | <xsl:with-param name="attribute" select="'glosslist-presentation'"/>
|
|---|
| 190 | </xsl:call-template>
|
|---|
| 191 | </xsl:variable>
|
|---|
| 192 |
|
|---|
| 193 | <xsl:variable name="term-width">
|
|---|
| 194 | <xsl:call-template name="dbfo-attribute">
|
|---|
| 195 | <xsl:with-param name="pis"
|
|---|
| 196 | select="processing-instruction('dbfo')"/>
|
|---|
| 197 | <xsl:with-param name="attribute" select="'glossterm-width'"/>
|
|---|
| 198 | </xsl:call-template>
|
|---|
| 199 | </xsl:variable>
|
|---|
| 200 |
|
|---|
| 201 | <xsl:variable name="width">
|
|---|
| 202 | <xsl:choose>
|
|---|
| 203 | <xsl:when test="$term-width = ''">
|
|---|
| 204 | <xsl:value-of select="$glossterm.width"/>
|
|---|
| 205 | </xsl:when>
|
|---|
| 206 | <xsl:otherwise>
|
|---|
| 207 | <xsl:value-of select="$term-width"/>
|
|---|
| 208 | </xsl:otherwise>
|
|---|
| 209 | </xsl:choose>
|
|---|
| 210 | </xsl:variable>
|
|---|
| 211 |
|
|---|
| 212 | <xsl:if test="title">
|
|---|
| 213 | <xsl:apply-templates select="title" mode="list.title.mode"/>
|
|---|
| 214 | </xsl:if>
|
|---|
| 215 |
|
|---|
| 216 | <xsl:choose>
|
|---|
| 217 | <xsl:when test="$presentation = 'list'">
|
|---|
| 218 | <fo:list-block provisional-distance-between-starts="{$width}"
|
|---|
| 219 | provisional-label-separation="{$glossterm.separation}"
|
|---|
| 220 | xsl:use-attribute-sets="normal.para.spacing">
|
|---|
| 221 | <xsl:apply-templates mode="glossary.as.list" select="glossentry"/>
|
|---|
| 222 | </fo:list-block>
|
|---|
| 223 | </xsl:when>
|
|---|
| 224 | <xsl:when test="$presentation = 'blocks'">
|
|---|
| 225 | <xsl:apply-templates mode="glossary.as.blocks" select="glossentry"/>
|
|---|
| 226 | </xsl:when>
|
|---|
| 227 | <xsl:when test="$glosslist.as.blocks != 0">
|
|---|
| 228 | <xsl:apply-templates mode="glossary.as.blocks" select="glossentry"/>
|
|---|
| 229 | </xsl:when>
|
|---|
| 230 | <xsl:otherwise>
|
|---|
| 231 | <fo:list-block provisional-distance-between-starts="{$width}"
|
|---|
| 232 | provisional-label-separation="{$glossterm.separation}"
|
|---|
| 233 | xsl:use-attribute-sets="normal.para.spacing">
|
|---|
| 234 | <xsl:apply-templates mode="glossary.as.list" select="glossentry"/>
|
|---|
| 235 | </fo:list-block>
|
|---|
| 236 | </xsl:otherwise>
|
|---|
| 237 | </xsl:choose>
|
|---|
| 238 | </xsl:template>
|
|---|
| 239 |
|
|---|
| 240 | <!-- ==================================================================== -->
|
|---|
| 241 | <!-- Glossary collection -->
|
|---|
| 242 |
|
|---|
| 243 | <xsl:template match="glossary[@role='auto']" priority="2">
|
|---|
| 244 | <xsl:variable name="collection" select="document($glossary.collection, .)"/>
|
|---|
| 245 | <xsl:if test="$glossary.collection = ''">
|
|---|
| 246 | <xsl:message>
|
|---|
| 247 | <xsl:text>Warning: processing automatic glossary </xsl:text>
|
|---|
| 248 | <xsl:text>without a glossary.collection file.</xsl:text>
|
|---|
| 249 | </xsl:message>
|
|---|
| 250 | </xsl:if>
|
|---|
| 251 |
|
|---|
| 252 | <xsl:if test="not($collection) and $glossary.collection != ''">
|
|---|
| 253 | <xsl:message>
|
|---|
| 254 | <xsl:text>Warning: processing automatic glossary but unable to </xsl:text>
|
|---|
| 255 | <xsl:text>open glossary.collection file '</xsl:text>
|
|---|
| 256 | <xsl:value-of select="$glossary.collection"/>
|
|---|
| 257 | <xsl:text>'</xsl:text>
|
|---|
| 258 | </xsl:message>
|
|---|
| 259 | </xsl:if>
|
|---|
| 260 |
|
|---|
| 261 | <xsl:call-template name="make-auto-glossary"/>
|
|---|
| 262 | </xsl:template>
|
|---|
| 263 |
|
|---|
| 264 | <xsl:template name="make-auto-glossary">
|
|---|
| 265 | <xsl:param name="collection" select="document($glossary.collection, .)"/>
|
|---|
| 266 | <xsl:param name="terms" select="//glossterm[not(parent::glossdef)]|//firstterm"/>
|
|---|
| 267 | <xsl:param name="preamble" select="*[not(self::title
|
|---|
| 268 | or self::subtitle
|
|---|
| 269 | or self::glossdiv
|
|---|
| 270 | or self::glossentry)]"/>
|
|---|
| 271 |
|
|---|
| 272 | <xsl:variable name="id">
|
|---|
| 273 | <xsl:call-template name="object.id"/>
|
|---|
| 274 | </xsl:variable>
|
|---|
| 275 |
|
|---|
| 276 | <xsl:variable name="presentation">
|
|---|
| 277 | <xsl:call-template name="dbfo-attribute">
|
|---|
| 278 | <xsl:with-param name="pis"
|
|---|
| 279 | select="processing-instruction('dbfo')"/>
|
|---|
| 280 | <xsl:with-param name="attribute" select="'glossary-presentation'"/>
|
|---|
| 281 | </xsl:call-template>
|
|---|
| 282 | </xsl:variable>
|
|---|
| 283 |
|
|---|
| 284 | <xsl:variable name="term-width">
|
|---|
| 285 | <xsl:call-template name="dbfo-attribute">
|
|---|
| 286 | <xsl:with-param name="pis"
|
|---|
| 287 | select="processing-instruction('dbfo')"/>
|
|---|
| 288 | <xsl:with-param name="attribute" select="'glossterm-width'"/>
|
|---|
| 289 | </xsl:call-template>
|
|---|
| 290 | </xsl:variable>
|
|---|
| 291 |
|
|---|
| 292 | <xsl:variable name="width">
|
|---|
| 293 | <xsl:choose>
|
|---|
| 294 | <xsl:when test="$term-width = ''">
|
|---|
| 295 | <xsl:value-of select="$glossterm.width"/>
|
|---|
| 296 | </xsl:when>
|
|---|
| 297 | <xsl:otherwise>
|
|---|
| 298 | <xsl:value-of select="$term-width"/>
|
|---|
| 299 | </xsl:otherwise>
|
|---|
| 300 | </xsl:choose>
|
|---|
| 301 | </xsl:variable>
|
|---|
| 302 |
|
|---|
| 303 | <xsl:if test="$glossary.collection = ''">
|
|---|
| 304 | <xsl:message>
|
|---|
| 305 | <xsl:text>Warning: processing automatic glossary </xsl:text>
|
|---|
| 306 | <xsl:text>without a glossary.collection file.</xsl:text>
|
|---|
| 307 | </xsl:message>
|
|---|
| 308 | </xsl:if>
|
|---|
| 309 |
|
|---|
| 310 | <fo:block id="{$id}">
|
|---|
| 311 | <xsl:call-template name="glossary.titlepage"/>
|
|---|
| 312 | </fo:block>
|
|---|
| 313 |
|
|---|
| 314 | <xsl:if test="$preamble">
|
|---|
| 315 | <xsl:apply-templates select="$preamble"/>
|
|---|
| 316 | </xsl:if>
|
|---|
| 317 |
|
|---|
| 318 | <xsl:choose>
|
|---|
| 319 | <xsl:when test="glossdiv and $collection//glossdiv">
|
|---|
| 320 | <xsl:for-each select="$collection//glossdiv">
|
|---|
| 321 | <!-- first see if there are any in this div -->
|
|---|
| 322 | <xsl:variable name="exist.test">
|
|---|
| 323 | <xsl:for-each select="glossentry">
|
|---|
| 324 | <xsl:variable name="cterm" select="glossterm"/>
|
|---|
| 325 | <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
|
|---|
| 326 | <xsl:value-of select="glossterm"/>
|
|---|
| 327 | </xsl:if>
|
|---|
| 328 | </xsl:for-each>
|
|---|
| 329 | </xsl:variable>
|
|---|
| 330 |
|
|---|
| 331 | <xsl:if test="$exist.test != ''">
|
|---|
| 332 | <xsl:choose>
|
|---|
| 333 | <xsl:when test="$presentation = 'list'">
|
|---|
| 334 | <xsl:apply-templates select="." mode="auto-glossary-as-list">
|
|---|
| 335 | <xsl:with-param name="width" select="$width"/>
|
|---|
| 336 | <xsl:with-param name="terms" select="$terms"/>
|
|---|
| 337 | </xsl:apply-templates>
|
|---|
| 338 | </xsl:when>
|
|---|
| 339 | <xsl:when test="$presentation = 'blocks'">
|
|---|
| 340 | <xsl:apply-templates select="." mode="auto-glossary-as-blocks">
|
|---|
| 341 | <xsl:with-param name="terms" select="$terms"/>
|
|---|
| 342 | </xsl:apply-templates>
|
|---|
| 343 | </xsl:when>
|
|---|
| 344 | <xsl:when test="$glossary.as.blocks != 0">
|
|---|
| 345 | <xsl:apply-templates select="." mode="auto-glossary-as-blocks">
|
|---|
| 346 | <xsl:with-param name="terms" select="$terms"/>
|
|---|
| 347 | </xsl:apply-templates>
|
|---|
| 348 | </xsl:when>
|
|---|
| 349 | <xsl:otherwise>
|
|---|
| 350 | <xsl:apply-templates select="." mode="auto-glossary-as-list">
|
|---|
| 351 | <xsl:with-param name="width" select="$width"/>
|
|---|
| 352 | <xsl:with-param name="terms" select="$terms"/>
|
|---|
| 353 | </xsl:apply-templates>
|
|---|
| 354 | </xsl:otherwise>
|
|---|
| 355 | </xsl:choose>
|
|---|
| 356 | </xsl:if>
|
|---|
| 357 | </xsl:for-each>
|
|---|
| 358 | </xsl:when>
|
|---|
| 359 | <xsl:otherwise>
|
|---|
| 360 | <xsl:choose>
|
|---|
| 361 | <xsl:when test="$presentation = 'list'">
|
|---|
| 362 | <fo:list-block provisional-distance-between-starts="{$width}"
|
|---|
| 363 | provisional-label-separation="{$glossterm.separation}"
|
|---|
| 364 | xsl:use-attribute-sets="normal.para.spacing">
|
|---|
| 365 | <xsl:for-each select="$collection//glossentry">
|
|---|
| 366 | <xsl:variable name="cterm" select="glossterm"/>
|
|---|
| 367 | <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
|
|---|
| 368 | <xsl:apply-templates select="." mode="auto-glossary-as-list"/>
|
|---|
| 369 | </xsl:if>
|
|---|
| 370 | </xsl:for-each>
|
|---|
| 371 | </fo:list-block>
|
|---|
| 372 | </xsl:when>
|
|---|
| 373 | <xsl:when test="$presentation = 'blocks'">
|
|---|
| 374 | <xsl:for-each select="$collection//glossentry">
|
|---|
| 375 | <xsl:variable name="cterm" select="glossterm"/>
|
|---|
| 376 | <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
|
|---|
| 377 | <xsl:apply-templates select="." mode="auto-glossary-as-blocks"/>
|
|---|
| 378 | </xsl:if>
|
|---|
| 379 | </xsl:for-each>
|
|---|
| 380 | </xsl:when>
|
|---|
| 381 | <xsl:when test="$glossary.as.blocks != 0">
|
|---|
| 382 | <xsl:for-each select="$collection//glossentry">
|
|---|
| 383 | <xsl:variable name="cterm" select="glossterm"/>
|
|---|
| 384 | <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
|
|---|
| 385 | <xsl:apply-templates select="." mode="auto-glossary-as-blocks"/>
|
|---|
| 386 | </xsl:if>
|
|---|
| 387 | </xsl:for-each>
|
|---|
| 388 | </xsl:when>
|
|---|
| 389 | <xsl:otherwise>
|
|---|
| 390 | <fo:list-block provisional-distance-between-starts="{$width}"
|
|---|
| 391 | provisional-label-separation="{$glossterm.separation}"
|
|---|
| 392 | xsl:use-attribute-sets="normal.para.spacing">
|
|---|
| 393 | <xsl:for-each select="$collection//glossentry">
|
|---|
| 394 | <xsl:variable name="cterm" select="glossterm"/>
|
|---|
| 395 | <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
|
|---|
| 396 | <xsl:apply-templates select="." mode="auto-glossary-as-list"/>
|
|---|
| 397 | </xsl:if>
|
|---|
| 398 | </xsl:for-each>
|
|---|
| 399 | </fo:list-block>
|
|---|
| 400 | </xsl:otherwise>
|
|---|
| 401 | </xsl:choose>
|
|---|
| 402 | </xsl:otherwise>
|
|---|
| 403 | </xsl:choose>
|
|---|
| 404 | </xsl:template>
|
|---|
| 405 |
|
|---|
| 406 | <xsl:template match="book/glossary[@role='auto']|/glossary[@role='auto']" priority="2.5">
|
|---|
| 407 | <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
|
|---|
| 408 |
|
|---|
| 409 | <xsl:variable name="master-reference">
|
|---|
| 410 | <xsl:call-template name="select.pagemaster"/>
|
|---|
| 411 | </xsl:variable>
|
|---|
| 412 |
|
|---|
| 413 | <xsl:if test="$glossary.collection = ''">
|
|---|
| 414 | <xsl:message>
|
|---|
| 415 | <xsl:text>Warning: processing automatic glossary </xsl:text>
|
|---|
| 416 | <xsl:text>without a glossary.collection file.</xsl:text>
|
|---|
| 417 | </xsl:message>
|
|---|
| 418 | </xsl:if>
|
|---|
| 419 |
|
|---|
| 420 | <fo:page-sequence hyphenate="{$hyphenate}"
|
|---|
| 421 | master-reference="{$master-reference}">
|
|---|
| 422 | <xsl:attribute name="language">
|
|---|
| 423 | <xsl:call-template name="l10n.language"/>
|
|---|
| 424 | </xsl:attribute>
|
|---|
| 425 | <xsl:attribute name="format">
|
|---|
| 426 | <xsl:call-template name="page.number.format">
|
|---|
| 427 | <xsl:with-param name="master-reference" select="$master-reference"/>
|
|---|
| 428 | </xsl:call-template>
|
|---|
| 429 | </xsl:attribute>
|
|---|
| 430 |
|
|---|
| 431 | <xsl:attribute name="initial-page-number">
|
|---|
| 432 | <xsl:call-template name="initial.page.number">
|
|---|
| 433 | <xsl:with-param name="master-reference" select="$master-reference"/>
|
|---|
| 434 | </xsl:call-template>
|
|---|
| 435 | </xsl:attribute>
|
|---|
| 436 |
|
|---|
| 437 | <xsl:attribute name="force-page-count">
|
|---|
| 438 | <xsl:call-template name="force.page.count">
|
|---|
| 439 | <xsl:with-param name="master-reference" select="$master-reference"/>
|
|---|
| 440 | </xsl:call-template>
|
|---|
| 441 | </xsl:attribute>
|
|---|
| 442 |
|
|---|
| 443 | <xsl:attribute name="hyphenation-character">
|
|---|
| 444 | <xsl:call-template name="gentext">
|
|---|
| 445 | <xsl:with-param name="key" select="'hyphenation-character'"/>
|
|---|
| 446 | </xsl:call-template>
|
|---|
| 447 | </xsl:attribute>
|
|---|
| 448 | <xsl:attribute name="hyphenation-push-character-count">
|
|---|
| 449 | <xsl:call-template name="gentext">
|
|---|
| 450 | <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
|
|---|
| 451 | </xsl:call-template>
|
|---|
| 452 | </xsl:attribute>
|
|---|
| 453 | <xsl:attribute name="hyphenation-remain-character-count">
|
|---|
| 454 | <xsl:call-template name="gentext">
|
|---|
| 455 | <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
|
|---|
| 456 | </xsl:call-template>
|
|---|
| 457 | </xsl:attribute>
|
|---|
| 458 |
|
|---|
| 459 | <xsl:apply-templates select="." mode="running.head.mode">
|
|---|
| 460 | <xsl:with-param name="master-reference" select="$master-reference"/>
|
|---|
| 461 | </xsl:apply-templates>
|
|---|
| 462 | <xsl:apply-templates select="." mode="running.foot.mode">
|
|---|
| 463 | <xsl:with-param name="master-reference" select="$master-reference"/>
|
|---|
| 464 | </xsl:apply-templates>
|
|---|
| 465 |
|
|---|
| 466 | <fo:flow flow-name="xsl-region-body">
|
|---|
| 467 | <xsl:call-template name="set.flow.properties">
|
|---|
| 468 | <xsl:with-param name="element" select="local-name(.)"/>
|
|---|
| 469 | <xsl:with-param name="master-reference" select="$master-reference"/>
|
|---|
| 470 | </xsl:call-template>
|
|---|
| 471 |
|
|---|
| 472 | <xsl:call-template name="make-auto-glossary"/>
|
|---|
| 473 | </fo:flow>
|
|---|
| 474 | </fo:page-sequence>
|
|---|
| 475 | </xsl:template>
|
|---|
| 476 |
|
|---|
| 477 | <xsl:template match="glossdiv" mode="auto-glossary-as-list">
|
|---|
| 478 | <xsl:param name="width" select="$glossterm.width"/>
|
|---|
| 479 | <xsl:param name="terms" select="."/>
|
|---|
| 480 |
|
|---|
| 481 | <xsl:variable name="preamble"
|
|---|
| 482 | select="*[not(self::title
|
|---|
| 483 | or self::subtitle
|
|---|
| 484 | or self::glossentry)]"/>
|
|---|
| 485 |
|
|---|
| 486 | <xsl:call-template name="glossdiv.titlepage"/>
|
|---|
| 487 |
|
|---|
| 488 | <xsl:apply-templates select="$preamble"/>
|
|---|
| 489 |
|
|---|
| 490 | <fo:list-block provisional-distance-between-starts="{$width}"
|
|---|
| 491 | provisional-label-separation="{$glossterm.separation}"
|
|---|
| 492 | xsl:use-attribute-sets="normal.para.spacing">
|
|---|
| 493 | <xsl:for-each select="glossentry">
|
|---|
| 494 | <xsl:variable name="cterm" select="glossterm"/>
|
|---|
| 495 | <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
|
|---|
| 496 | <xsl:apply-templates select="." mode="auto-glossary-as-list"/>
|
|---|
| 497 | </xsl:if>
|
|---|
| 498 | </xsl:for-each>
|
|---|
| 499 | </fo:list-block>
|
|---|
| 500 | </xsl:template>
|
|---|
| 501 |
|
|---|
| 502 | <xsl:template match="glossentry" mode="auto-glossary-as-list">
|
|---|
| 503 | <xsl:apply-templates select="." mode="glossary.as.list"/>
|
|---|
| 504 | </xsl:template>
|
|---|
| 505 |
|
|---|
| 506 | <xsl:template match="glossdiv" mode="auto-glossary-as-blocks">
|
|---|
| 507 | <xsl:param name="terms" select="."/>
|
|---|
| 508 |
|
|---|
| 509 | <xsl:variable name="preamble"
|
|---|
| 510 | select="*[not(self::title
|
|---|
| 511 | or self::subtitle
|
|---|
| 512 | or self::glossentry)]"/>
|
|---|
| 513 |
|
|---|
| 514 | <xsl:call-template name="glossdiv.titlepage"/>
|
|---|
| 515 |
|
|---|
| 516 | <xsl:apply-templates select="$preamble"/>
|
|---|
| 517 |
|
|---|
| 518 | <xsl:for-each select="glossentry">
|
|---|
| 519 | <xsl:variable name="cterm" select="glossterm"/>
|
|---|
| 520 | <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
|
|---|
| 521 | <xsl:apply-templates select="." mode="auto-glossary-as-blocks"/>
|
|---|
| 522 | </xsl:if>
|
|---|
| 523 | </xsl:for-each>
|
|---|
| 524 | </xsl:template>
|
|---|
| 525 |
|
|---|
| 526 | <xsl:template match="glossentry" mode="auto-glossary-as-blocks">
|
|---|
| 527 | <xsl:apply-templates select="." mode="glossary.as.blocks"/>
|
|---|
| 528 | </xsl:template>
|
|---|
| 529 |
|
|---|
| 530 | <!-- ==================================================================== -->
|
|---|
| 531 | <!-- Format glossary as a list -->
|
|---|
| 532 |
|
|---|
| 533 | <xsl:template match="glossdiv" mode="glossary.as.list">
|
|---|
| 534 | <xsl:param name="width" select="$glossterm.width"/>
|
|---|
| 535 |
|
|---|
| 536 | <xsl:variable name="entries" select="glossentry"/>
|
|---|
| 537 | <xsl:variable name="preamble"
|
|---|
| 538 | select="*[not(self::title
|
|---|
| 539 | or self::subtitle
|
|---|
| 540 | or self::glossentry)]"/>
|
|---|
| 541 |
|
|---|
| 542 | <xsl:call-template name="glossdiv.titlepage"/>
|
|---|
| 543 |
|
|---|
| 544 | <xsl:apply-templates select="$preamble"/>
|
|---|
| 545 |
|
|---|
| 546 | <fo:list-block provisional-distance-between-starts="{$width}"
|
|---|
| 547 | provisional-label-separation="{$glossterm.separation}"
|
|---|
| 548 | xsl:use-attribute-sets="normal.para.spacing">
|
|---|
| 549 | <xsl:apply-templates select="$entries" mode="glossary.as.list"/>
|
|---|
| 550 | </fo:list-block>
|
|---|
| 551 | </xsl:template>
|
|---|
| 552 |
|
|---|
| 553 | <!--
|
|---|
| 554 | GlossEntry ::=
|
|---|
| 555 | GlossTerm, Acronym?, Abbrev?,
|
|---|
| 556 | (IndexTerm)*,
|
|---|
| 557 | RevHistory?,
|
|---|
| 558 | (GlossSee | GlossDef+)
|
|---|
| 559 | -->
|
|---|
| 560 |
|
|---|
| 561 | <xsl:template match="glossentry" mode="glossary.as.list">
|
|---|
| 562 | <xsl:variable name="id">
|
|---|
| 563 | <xsl:call-template name="object.id"/>
|
|---|
| 564 | </xsl:variable>
|
|---|
| 565 |
|
|---|
| 566 | <fo:list-item xsl:use-attribute-sets="normal.para.spacing">
|
|---|
| 567 | <xsl:call-template name="anchor">
|
|---|
| 568 | <xsl:with-param name="conditional">
|
|---|
| 569 | <xsl:choose>
|
|---|
| 570 | <xsl:when test="$glossterm.auto.link != 0
|
|---|
| 571 | or $glossary.collection != ''">0</xsl:when>
|
|---|
| 572 | <xsl:otherwise>1</xsl:otherwise>
|
|---|
| 573 | </xsl:choose>
|
|---|
| 574 | </xsl:with-param>
|
|---|
| 575 | </xsl:call-template>
|
|---|
| 576 |
|
|---|
| 577 | <fo:list-item-label end-indent="label-end()">
|
|---|
| 578 | <fo:block>
|
|---|
| 579 | <xsl:choose>
|
|---|
| 580 | <xsl:when test="$glossentry.show.acronym = 'primary'">
|
|---|
| 581 | <xsl:choose>
|
|---|
| 582 | <xsl:when test="acronym|abbrev">
|
|---|
| 583 | <xsl:apply-templates select="acronym|abbrev" mode="glossary.as.list"/>
|
|---|
| 584 | <xsl:text> (</xsl:text>
|
|---|
| 585 | <xsl:apply-templates select="glossterm" mode="glossary.as.list"/>
|
|---|
| 586 | <xsl:text>)</xsl:text>
|
|---|
| 587 | </xsl:when>
|
|---|
| 588 | <xsl:otherwise>
|
|---|
| 589 | <xsl:apply-templates select="glossterm" mode="glossary.as.list"/>
|
|---|
| 590 | </xsl:otherwise>
|
|---|
| 591 | </xsl:choose>
|
|---|
| 592 | </xsl:when>
|
|---|
| 593 |
|
|---|
| 594 | <xsl:when test="$glossentry.show.acronym = 'yes'">
|
|---|
| 595 | <xsl:apply-templates select="glossterm" mode="glossary.as.list"/>
|
|---|
| 596 |
|
|---|
| 597 | <xsl:if test="acronym|abbrev">
|
|---|
| 598 | <xsl:text> (</xsl:text>
|
|---|
| 599 | <xsl:apply-templates select="acronym|abbrev" mode="glossary.as.list"/>
|
|---|
| 600 | <xsl:text>)</xsl:text>
|
|---|
| 601 | </xsl:if>
|
|---|
| 602 | </xsl:when>
|
|---|
| 603 |
|
|---|
| 604 | <xsl:otherwise>
|
|---|
| 605 | <xsl:apply-templates select="glossterm" mode="glossary.as.list"/>
|
|---|
| 606 | </xsl:otherwise>
|
|---|
| 607 | </xsl:choose>
|
|---|
| 608 | <xsl:apply-templates select="indexterm"/>
|
|---|
| 609 | </fo:block>
|
|---|
| 610 | </fo:list-item-label>
|
|---|
| 611 |
|
|---|
| 612 | <fo:list-item-body start-indent="body-start()">
|
|---|
| 613 | <xsl:apply-templates select="glosssee|glossdef" mode="glossary.as.list"/>
|
|---|
| 614 | </fo:list-item-body>
|
|---|
| 615 | </fo:list-item>
|
|---|
| 616 | </xsl:template>
|
|---|
| 617 |
|
|---|
| 618 | <xsl:template match="glossentry/glossterm" mode="glossary.as.list">
|
|---|
| 619 | <xsl:variable name="id">
|
|---|
| 620 | <xsl:call-template name="object.id"/>
|
|---|
| 621 | </xsl:variable>
|
|---|
| 622 | <fo:inline id="{$id}">
|
|---|
| 623 | <xsl:apply-templates/>
|
|---|
| 624 | </fo:inline>
|
|---|
| 625 | <xsl:if test="following-sibling::glossterm">, </xsl:if>
|
|---|
| 626 | </xsl:template>
|
|---|
| 627 |
|
|---|
| 628 | <xsl:template match="glossentry/acronym" mode="glossary.as.list">
|
|---|
| 629 | <xsl:apply-templates/>
|
|---|
| 630 | <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
|
|---|
| 631 | </xsl:template>
|
|---|
| 632 |
|
|---|
| 633 | <xsl:template match="glossentry/abbrev" mode="glossary.as.list">
|
|---|
| 634 | <xsl:apply-templates/>
|
|---|
| 635 | <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
|
|---|
| 636 | </xsl:template>
|
|---|
| 637 |
|
|---|
| 638 | <xsl:template match="glossentry/revhistory" mode="glossary.as.list">
|
|---|
| 639 | </xsl:template>
|
|---|
| 640 |
|
|---|
| 641 | <xsl:template match="glossentry/glosssee" mode="glossary.as.list">
|
|---|
| 642 | <xsl:variable name="otherterm" select="@otherterm"/>
|
|---|
| 643 | <xsl:variable name="targets" select="//node()[@id=$otherterm]"/>
|
|---|
| 644 | <xsl:variable name="target" select="$targets[1]"/>
|
|---|
| 645 |
|
|---|
| 646 | <fo:block>
|
|---|
| 647 | <xsl:variable name="template">
|
|---|
| 648 | <xsl:call-template name="gentext.template">
|
|---|
| 649 | <xsl:with-param name="context" select="'glossary'"/>
|
|---|
| 650 | <xsl:with-param name="name" select="'see'"/>
|
|---|
| 651 | </xsl:call-template>
|
|---|
| 652 | </xsl:variable>
|
|---|
| 653 | <xsl:variable name="title">
|
|---|
| 654 | <xsl:choose>
|
|---|
| 655 | <xsl:when test="$target">
|
|---|
| 656 | <fo:basic-link internal-destination="{$otherterm}"
|
|---|
| 657 | xsl:use-attribute-sets="xref.properties">
|
|---|
| 658 | <xsl:apply-templates select="$target" mode="xref-to"/>
|
|---|
| 659 | </fo:basic-link>
|
|---|
| 660 | </xsl:when>
|
|---|
| 661 | <xsl:when test="$otherterm != '' and not($target)">
|
|---|
| 662 | <xsl:message>
|
|---|
| 663 | <xsl:text>Warning: glosssee @otherterm reference not found: </xsl:text>
|
|---|
| 664 | <xsl:value-of select="$otherterm"/>
|
|---|
| 665 | </xsl:message>
|
|---|
| 666 | <xsl:apply-templates mode="glossary.as.list"/>
|
|---|
| 667 | </xsl:when>
|
|---|
| 668 | <xsl:otherwise>
|
|---|
| 669 | <xsl:apply-templates mode="glossary.as.list"/>
|
|---|
| 670 | </xsl:otherwise>
|
|---|
| 671 | </xsl:choose>
|
|---|
| 672 | </xsl:variable>
|
|---|
| 673 | <xsl:call-template name="substitute-markup">
|
|---|
| 674 | <xsl:with-param name="template" select="$template"/>
|
|---|
| 675 | <xsl:with-param name="title" select="$title"/>
|
|---|
| 676 | </xsl:call-template>
|
|---|
| 677 |
|
|---|
| 678 | <xsl:text>.</xsl:text>
|
|---|
| 679 | </fo:block>
|
|---|
| 680 | </xsl:template>
|
|---|
| 681 |
|
|---|
| 682 | <xsl:template match="glossentry/glossdef" mode="glossary.as.list">
|
|---|
| 683 | <xsl:apply-templates select="*[local-name(.) != 'glossseealso']"/>
|
|---|
| 684 | <xsl:if test="glossseealso">
|
|---|
| 685 | <fo:block>
|
|---|
| 686 | <xsl:variable name="template">
|
|---|
| 687 | <xsl:call-template name="gentext.template">
|
|---|
| 688 | <xsl:with-param name="context" select="'glossary'"/>
|
|---|
| 689 | <xsl:with-param name="name" select="'seealso'"/>
|
|---|
| 690 | </xsl:call-template>
|
|---|
| 691 | </xsl:variable>
|
|---|
| 692 | <xsl:variable name="title">
|
|---|
| 693 | <xsl:apply-templates select="glossseealso" mode="glossary.as.list"/>
|
|---|
| 694 | </xsl:variable>
|
|---|
| 695 | <xsl:call-template name="substitute-markup">
|
|---|
| 696 | <xsl:with-param name="template" select="$template"/>
|
|---|
| 697 | <xsl:with-param name="title" select="$title"/>
|
|---|
| 698 | </xsl:call-template>
|
|---|
| 699 | </fo:block>
|
|---|
| 700 | </xsl:if>
|
|---|
| 701 | </xsl:template>
|
|---|
| 702 |
|
|---|
| 703 | <xsl:template match="glossentry/glossdef/para[1]|glossentry/glossdef/simpara[1]"
|
|---|
| 704 | mode="glossary.as.list">
|
|---|
| 705 | <fo:block>
|
|---|
| 706 | <xsl:apply-templates/>
|
|---|
| 707 | </fo:block>
|
|---|
| 708 | </xsl:template>
|
|---|
| 709 |
|
|---|
| 710 | <xsl:template match="glossseealso" mode="glossary.as.list">
|
|---|
| 711 | <xsl:variable name="otherterm" select="@otherterm"/>
|
|---|
| 712 | <xsl:variable name="targets" select="//node()[@id=$otherterm]"/>
|
|---|
| 713 | <xsl:variable name="target" select="$targets[1]"/>
|
|---|
| 714 |
|
|---|
| 715 | <xsl:choose>
|
|---|
| 716 | <xsl:when test="$target">
|
|---|
| 717 | <fo:basic-link internal-destination="{$otherterm}"
|
|---|
| 718 | xsl:use-attribute-sets="xref.properties">
|
|---|
| 719 | <xsl:apply-templates select="$target" mode="xref-to"/>
|
|---|
| 720 | </fo:basic-link>
|
|---|
| 721 | </xsl:when>
|
|---|
| 722 | <xsl:when test="$otherterm != '' and not($target)">
|
|---|
| 723 | <xsl:message>
|
|---|
| 724 | <xsl:text>Warning: glossseealso @otherterm reference not found: </xsl:text>
|
|---|
| 725 | <xsl:value-of select="$otherterm"/>
|
|---|
| 726 | </xsl:message>
|
|---|
| 727 | <xsl:apply-templates mode="glossary.as.list"/>
|
|---|
| 728 | </xsl:when>
|
|---|
| 729 | <xsl:otherwise>
|
|---|
| 730 | <xsl:apply-templates mode="glossary.as.list"/>
|
|---|
| 731 | </xsl:otherwise>
|
|---|
| 732 | </xsl:choose>
|
|---|
| 733 |
|
|---|
| 734 | <xsl:choose>
|
|---|
| 735 | <xsl:when test="position() = last()">
|
|---|
| 736 | <xsl:text>.</xsl:text>
|
|---|
| 737 | </xsl:when>
|
|---|
| 738 | <xsl:otherwise>
|
|---|
| 739 | <xsl:text>, </xsl:text>
|
|---|
| 740 | </xsl:otherwise>
|
|---|
| 741 | </xsl:choose>
|
|---|
| 742 | </xsl:template>
|
|---|
| 743 |
|
|---|
| 744 | <!-- ==================================================================== -->
|
|---|
| 745 | <!-- Format glossary blocks -->
|
|---|
| 746 |
|
|---|
| 747 | <xsl:template match="glossdiv" mode="glossary.as.blocks">
|
|---|
| 748 | <xsl:variable name="entries" select="glossentry"/>
|
|---|
| 749 | <xsl:variable name="preamble"
|
|---|
| 750 | select="*[not(self::title
|
|---|
| 751 | or self::subtitle
|
|---|
| 752 | or self::glossentry)]"/>
|
|---|
| 753 |
|
|---|
| 754 | <xsl:call-template name="glossdiv.titlepage"/>
|
|---|
| 755 |
|
|---|
| 756 | <xsl:apply-templates select="$preamble"/>
|
|---|
| 757 |
|
|---|
| 758 | <xsl:apply-templates select="$entries" mode="glossary.as.blocks"/>
|
|---|
| 759 | </xsl:template>
|
|---|
| 760 |
|
|---|
| 761 | <!--
|
|---|
| 762 | GlossEntry ::=
|
|---|
| 763 | GlossTerm, Acronym?, Abbrev?,
|
|---|
| 764 | (IndexTerm)*,
|
|---|
| 765 | RevHistory?,
|
|---|
| 766 | (GlossSee | GlossDef+)
|
|---|
| 767 | -->
|
|---|
| 768 |
|
|---|
| 769 | <xsl:template match="glossentry" mode="glossary.as.blocks">
|
|---|
| 770 | <xsl:variable name="id">
|
|---|
| 771 | <xsl:call-template name="object.id"/>
|
|---|
| 772 | </xsl:variable>
|
|---|
| 773 |
|
|---|
| 774 | <fo:block xsl:use-attribute-sets="list.item.spacing"
|
|---|
| 775 | keep-with-next.within-column="always"
|
|---|
| 776 | keep-together.within-column="always">
|
|---|
| 777 | <xsl:call-template name="anchor">
|
|---|
| 778 | <xsl:with-param name="conditional">
|
|---|
| 779 | <xsl:choose>
|
|---|
| 780 | <xsl:when test="$glossterm.auto.link != 0
|
|---|
| 781 | or $glossary.collection != ''">0</xsl:when>
|
|---|
| 782 | <xsl:otherwise>1</xsl:otherwise>
|
|---|
| 783 | </xsl:choose>
|
|---|
| 784 | </xsl:with-param>
|
|---|
| 785 | </xsl:call-template>
|
|---|
| 786 |
|
|---|
| 787 | <xsl:choose>
|
|---|
| 788 | <xsl:when test="$glossentry.show.acronym = 'primary'">
|
|---|
| 789 | <xsl:choose>
|
|---|
| 790 | <xsl:when test="acronym|abbrev">
|
|---|
| 791 | <xsl:apply-templates select="acronym|abbrev" mode="glossary.as.blocks"/>
|
|---|
| 792 | <xsl:text> (</xsl:text>
|
|---|
| 793 | <xsl:apply-templates select="glossterm" mode="glossary.as.blocks"/>
|
|---|
| 794 | <xsl:text>)</xsl:text>
|
|---|
| 795 | </xsl:when>
|
|---|
| 796 | <xsl:otherwise>
|
|---|
| 797 | <xsl:apply-templates select="glossterm" mode="glossary.as.blocks"/>
|
|---|
| 798 | </xsl:otherwise>
|
|---|
| 799 | </xsl:choose>
|
|---|
| 800 | </xsl:when>
|
|---|
| 801 |
|
|---|
| 802 | <xsl:when test="$glossentry.show.acronym = 'yes'">
|
|---|
| 803 | <xsl:apply-templates select="glossterm" mode="glossary.as.blocks"/>
|
|---|
| 804 |
|
|---|
| 805 | <xsl:if test="acronym|abbrev">
|
|---|
| 806 | <xsl:text> (</xsl:text>
|
|---|
| 807 | <xsl:apply-templates select="acronym|abbrev" mode="glossary.as.blocks"/>
|
|---|
| 808 | <xsl:text>)</xsl:text>
|
|---|
| 809 | </xsl:if>
|
|---|
| 810 | </xsl:when>
|
|---|
| 811 |
|
|---|
| 812 | <xsl:otherwise>
|
|---|
| 813 | <xsl:apply-templates select="glossterm" mode="glossary.as.blocks"/>
|
|---|
| 814 | </xsl:otherwise>
|
|---|
| 815 | </xsl:choose>
|
|---|
| 816 |
|
|---|
| 817 | <xsl:apply-templates select="indexterm"/>
|
|---|
| 818 | </fo:block>
|
|---|
| 819 |
|
|---|
| 820 | <fo:block margin-left="0.25in">
|
|---|
| 821 | <xsl:apply-templates select="glosssee|glossdef" mode="glossary.as.blocks"/>
|
|---|
| 822 | </fo:block>
|
|---|
| 823 | </xsl:template>
|
|---|
| 824 |
|
|---|
| 825 | <xsl:template match="glossentry/glossterm" mode="glossary.as.blocks">
|
|---|
| 826 | <xsl:variable name="id">
|
|---|
| 827 | <xsl:call-template name="object.id"/>
|
|---|
| 828 | </xsl:variable>
|
|---|
| 829 | <fo:inline id="{$id}">
|
|---|
| 830 | <xsl:apply-templates/>
|
|---|
| 831 | </fo:inline>
|
|---|
| 832 | <xsl:if test="following-sibling::glossterm">, </xsl:if>
|
|---|
| 833 | </xsl:template>
|
|---|
| 834 |
|
|---|
| 835 | <xsl:template match="glossentry/acronym" mode="glossary.as.blocks">
|
|---|
| 836 | <xsl:apply-templates/>
|
|---|
| 837 | <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
|
|---|
| 838 | </xsl:template>
|
|---|
| 839 |
|
|---|
| 840 | <xsl:template match="glossentry/abbrev" mode="glossary.as.blocks">
|
|---|
| 841 | <xsl:apply-templates/>
|
|---|
| 842 | <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
|
|---|
| 843 | </xsl:template>
|
|---|
| 844 |
|
|---|
| 845 | <xsl:template match="glossentry/glosssee" mode="glossary.as.blocks">
|
|---|
| 846 | <xsl:variable name="otherterm" select="@otherterm"/>
|
|---|
| 847 | <xsl:variable name="targets" select="//node()[@id=$otherterm]"/>
|
|---|
| 848 | <xsl:variable name="target" select="$targets[1]"/>
|
|---|
| 849 |
|
|---|
| 850 | <xsl:variable name="template">
|
|---|
| 851 | <xsl:call-template name="gentext.template">
|
|---|
| 852 | <xsl:with-param name="context" select="'glossary'"/>
|
|---|
| 853 | <xsl:with-param name="name" select="'see'"/>
|
|---|
| 854 | </xsl:call-template>
|
|---|
| 855 | </xsl:variable>
|
|---|
| 856 | <xsl:variable name="title">
|
|---|
| 857 | <xsl:choose>
|
|---|
| 858 | <xsl:when test="$target">
|
|---|
| 859 | <fo:basic-link internal-destination="{$otherterm}"
|
|---|
| 860 | xsl:use-attribute-sets="xref.properties">
|
|---|
| 861 | <xsl:apply-templates select="$target" mode="xref-to"/>
|
|---|
| 862 | </fo:basic-link>
|
|---|
| 863 | </xsl:when>
|
|---|
| 864 | <xsl:when test="$otherterm != '' and not($target)">
|
|---|
| 865 | <xsl:message>
|
|---|
| 866 | <xsl:text>Warning: glosssee @otherterm reference not found: </xsl:text>
|
|---|
| 867 | <xsl:value-of select="$otherterm"/>
|
|---|
| 868 | </xsl:message>
|
|---|
| 869 | <xsl:apply-templates mode="glossary.as.blocks"/>
|
|---|
| 870 | </xsl:when>
|
|---|
| 871 | <xsl:otherwise>
|
|---|
| 872 | <xsl:apply-templates mode="glossary.as.blocks"/>
|
|---|
| 873 | </xsl:otherwise>
|
|---|
| 874 | </xsl:choose>
|
|---|
| 875 | </xsl:variable>
|
|---|
| 876 | <xsl:call-template name="substitute-markup">
|
|---|
| 877 | <xsl:with-param name="template" select="$template"/>
|
|---|
| 878 | <xsl:with-param name="title" select="$title"/>
|
|---|
| 879 | </xsl:call-template>
|
|---|
| 880 |
|
|---|
| 881 | <xsl:text>.</xsl:text>
|
|---|
| 882 | </xsl:template>
|
|---|
| 883 |
|
|---|
| 884 | <xsl:template match="glossentry/glossdef" mode="glossary.as.blocks">
|
|---|
| 885 | <xsl:apply-templates select="*[local-name(.) != 'glossseealso']"
|
|---|
| 886 | mode="glossary.as.blocks"/>
|
|---|
| 887 | <xsl:if test="glossseealso">
|
|---|
| 888 | <fo:block>
|
|---|
| 889 | <xsl:variable name="template">
|
|---|
| 890 | <xsl:call-template name="gentext.template">
|
|---|
| 891 | <xsl:with-param name="context" select="'glossary'"/>
|
|---|
| 892 | <xsl:with-param name="name" select="'seealso'"/>
|
|---|
| 893 | </xsl:call-template>
|
|---|
| 894 | </xsl:variable>
|
|---|
| 895 | <xsl:variable name="title">
|
|---|
| 896 | <xsl:apply-templates select="glossseealso" mode="glossary.as.blocks"/>
|
|---|
| 897 | </xsl:variable>
|
|---|
| 898 | <xsl:call-template name="substitute-markup">
|
|---|
| 899 | <xsl:with-param name="template" select="$template"/>
|
|---|
| 900 | <xsl:with-param name="title" select="$title"/>
|
|---|
| 901 | </xsl:call-template>
|
|---|
| 902 | </fo:block>
|
|---|
| 903 | </xsl:if>
|
|---|
| 904 | </xsl:template>
|
|---|
| 905 |
|
|---|
| 906 | <xsl:template match="glossentry/glossdef/para[1]|glossentry/glossdef/simpara[1]"
|
|---|
| 907 | mode="glossary.as.blocks">
|
|---|
| 908 | <fo:block>
|
|---|
| 909 | <xsl:apply-templates/>
|
|---|
| 910 | </fo:block>
|
|---|
| 911 | </xsl:template>
|
|---|
| 912 |
|
|---|
| 913 | <!-- Handle any other glossdef content normally -->
|
|---|
| 914 | <xsl:template match="*" mode="glossary.as.blocks">
|
|---|
| 915 | <xsl:apply-templates select="." />
|
|---|
| 916 | </xsl:template>
|
|---|
| 917 |
|
|---|
| 918 | <xsl:template match="glossseealso" mode="glossary.as.blocks">
|
|---|
| 919 | <xsl:variable name="otherterm" select="@otherterm"/>
|
|---|
| 920 | <xsl:variable name="targets" select="//node()[@id=$otherterm]"/>
|
|---|
| 921 | <xsl:variable name="target" select="$targets[1]"/>
|
|---|
| 922 |
|
|---|
| 923 | <xsl:choose>
|
|---|
| 924 | <xsl:when test="$target">
|
|---|
| 925 | <fo:basic-link internal-destination="{$otherterm}"
|
|---|
| 926 | xsl:use-attribute-sets="xref.properties">
|
|---|
| 927 | <xsl:apply-templates select="$target" mode="xref-to"/>
|
|---|
| 928 | </fo:basic-link>
|
|---|
| 929 | </xsl:when>
|
|---|
| 930 | <xsl:when test="$otherterm != '' and not($target)">
|
|---|
| 931 | <xsl:message>
|
|---|
| 932 | <xsl:text>Warning: glossseealso @otherterm reference not found: </xsl:text>
|
|---|
| 933 | <xsl:value-of select="$otherterm"/>
|
|---|
| 934 | </xsl:message>
|
|---|
| 935 | <xsl:apply-templates mode="glossary.as.blocks"/>
|
|---|
| 936 | </xsl:when>
|
|---|
| 937 | <xsl:otherwise>
|
|---|
| 938 | <xsl:apply-templates mode="glossary.as.blocks"/>
|
|---|
| 939 | </xsl:otherwise>
|
|---|
| 940 | </xsl:choose>
|
|---|
| 941 |
|
|---|
| 942 | <xsl:choose>
|
|---|
| 943 | <xsl:when test="position() = last()">
|
|---|
| 944 | <xsl:text>.</xsl:text>
|
|---|
| 945 | </xsl:when>
|
|---|
| 946 | <xsl:otherwise>
|
|---|
| 947 | <xsl:text>, </xsl:text>
|
|---|
| 948 | </xsl:otherwise>
|
|---|
| 949 | </xsl:choose>
|
|---|
| 950 | </xsl:template>
|
|---|
| 951 |
|
|---|
| 952 | <!-- ==================================================================== -->
|
|---|
| 953 |
|
|---|
| 954 | </xsl:stylesheet>
|
|---|