| 1 |
<?xml version='1.0'?> |
| 2 |
<!DOCTYPE xsl:stylesheet [ |
| 3 |
<!ENTITY % common.entities SYSTEM "../common/entities.ent"> |
| 4 |
%common.entities; |
| 5 |
]> |
| 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" |
| 11 |
version='1.0'> |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
<xsl:template match="d:glossary"> |
| 24 |
<xsl:call-template name="make-glossary"/> |
| 25 |
</xsl:template> |
| 26 |
|
| 27 |
<xsl:template match="d:glossdiv/d:title"/> |
| 28 |
<xsl:template match="d:glossdiv/d:subtitle"/> |
| 29 |
<xsl:template match="d:glossdiv/d:titleabbrev"/> |
| 30 |
|
| 31 |
|
| 32 |
|
| 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 |
| 37 |
or self::d:subtitle |
| 38 |
or self::d:glossdiv |
| 39 |
or self::d:glossentry)]"/> |
| 40 |
|
| 41 |
&setup-language-variable; |
| 42 |
|
| 43 |
<xsl:variable name="id"> |
| 44 |
<xsl:call-template name="object.id"/> |
| 45 |
</xsl:variable> |
| 46 |
|
| 47 |
<xsl:variable name="presentation"> |
| 48 |
<xsl:call-template name="pi.dbfo_glossary-presentation"/> |
| 49 |
</xsl:variable> |
| 50 |
|
| 51 |
<xsl:variable name="term-width"> |
| 52 |
<xsl:call-template name="pi.dbfo_glossterm-width"/> |
| 53 |
</xsl:variable> |
| 54 |
|
| 55 |
<xsl:variable name="width"> |
| 56 |
<xsl:choose> |
| 57 |
<xsl:when test="$term-width = ''"> |
| 58 |
<xsl:value-of select="$glossterm.width"/> |
| 59 |
</xsl:when> |
| 60 |
<xsl:otherwise> |
| 61 |
<xsl:value-of select="$term-width"/> |
| 62 |
</xsl:otherwise> |
| 63 |
</xsl:choose> |
| 64 |
</xsl:variable> |
| 65 |
|
| 66 |
<fo:block id="{$id}"> |
| 67 |
<xsl:call-template name="glossary.titlepage"/> |
| 68 |
</fo:block> |
| 69 |
|
| 70 |
<xsl:if test="$preamble"> |
| 71 |
<xsl:apply-templates select="$preamble"/> |
| 72 |
</xsl:if> |
| 73 |
|
| 74 |
<xsl:choose> |
| 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"> |
| 83 |
<xsl:choose> |
| 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> |
| 88 |
</xsl:when> |
| 89 |
<xsl:otherwise> |
| 90 |
<xsl:apply-templates select="$entries" mode="glossary.as.list"/> |
| 91 |
</xsl:otherwise> |
| 92 |
</xsl:choose> |
| 93 |
</fo:list-block> |
| 94 |
</xsl:if> |
| 95 |
</xsl:when> |
| 96 |
<xsl:when test="$presentation = 'blocks'"> |
| 97 |
<xsl:apply-templates select="$divs" mode="glossary.as.blocks"/> |
| 98 |
<xsl:choose> |
| 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> |
| 103 |
</xsl:when> |
| 104 |
<xsl:otherwise> |
| 105 |
<xsl:apply-templates select="$entries" mode="glossary.as.blocks"/> |
| 106 |
</xsl:otherwise> |
| 107 |
</xsl:choose> |
| 108 |
</xsl:when> |
| 109 |
<xsl:when test="$glossary.as.blocks != 0"> |
| 110 |
<xsl:apply-templates select="$divs" mode="glossary.as.blocks"/> |
| 111 |
<xsl:choose> |
| 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> |
| 116 |
</xsl:when> |
| 117 |
<xsl:otherwise> |
| 118 |
<xsl:apply-templates select="$entries" mode="glossary.as.blocks"/> |
| 119 |
</xsl:otherwise> |
| 120 |
</xsl:choose> |
| 121 |
</xsl:when> |
| 122 |
<xsl:otherwise> |
| 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"> |
| 130 |
<xsl:choose> |
| 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> |
| 135 |
</xsl:when> |
| 136 |
<xsl:otherwise> |
| 137 |
<xsl:apply-templates select="$entries" mode="glossary.as.list"/> |
| 138 |
</xsl:otherwise> |
| 139 |
</xsl:choose> |
| 140 |
</fo:list-block> |
| 141 |
</xsl:if> |
| 142 |
</xsl:otherwise> |
| 143 |
</xsl:choose> |
| 144 |
</xsl:template> |
| 145 |
|
| 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"/> |
| 149 |
</xsl:variable> |
| 150 |
|
| 151 |
<xsl:variable name="master-reference"> |
| 152 |
<xsl:call-template name="select.pagemaster"/> |
| 153 |
</xsl:variable> |
| 154 |
|
| 155 |
<fo:page-sequence hyphenate="{$hyphenate}" |
| 156 |
master-reference="{$master-reference}"> |
| 157 |
<xsl:attribute name="language"> |
| 158 |
<xsl:call-template name="l10n.language"/> |
| 159 |
</xsl:attribute> |
| 160 |
|
| 161 |
<xsl:attribute name="format"> |
| 162 |
<xsl:call-template name="page.number.format"> |
| 163 |
<xsl:with-param name="master-reference" select="$master-reference"/> |
| 164 |
</xsl:call-template> |
| 165 |
</xsl:attribute> |
| 166 |
|
| 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"/> |
| 170 |
</xsl:call-template> |
| 171 |
</xsl:attribute> |
| 172 |
|
| 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"/> |
| 176 |
</xsl:call-template> |
| 177 |
</xsl:attribute> |
| 178 |
|
| 179 |
<xsl:attribute name="hyphenation-character"> |
| 180 |
<xsl:call-template name="gentext"> |
| 181 |
<xsl:with-param name="key" select="'hyphenation-character'"/> |
| 182 |
</xsl:call-template> |
| 183 |
</xsl:attribute> |
| 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'"/> |
| 187 |
</xsl:call-template> |
| 188 |
</xsl:attribute> |
| 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'"/> |
| 192 |
</xsl:call-template> |
| 193 |
</xsl:attribute> |
| 194 |
|
| 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> |
| 201 |
|
| 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"/> |
| 206 |
</xsl:call-template> |
| 207 |
|
| 208 |
<xsl:call-template name="make-glossary"/> |
| 209 |
</fo:flow> |
| 210 |
</fo:page-sequence> |
| 211 |
</xsl:template> |
| 212 |
|
| 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> |
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
<xsl:template match="d:glosslist"> |
| 222 |
&setup-language-variable; |
| 223 |
|
| 224 |
<xsl:variable name="presentation"> |
| 225 |
<xsl:call-template name="pi.dbfo_glosslist-presentation"/> |
| 226 |
</xsl:variable> |
| 227 |
|
| 228 |
<xsl:variable name="term-width"> |
| 229 |
<xsl:call-template name="pi.dbfo_glossterm-width"/> |
| 230 |
</xsl:variable> |
| 231 |
|
| 232 |
<xsl:variable name="width"> |
| 233 |
<xsl:choose> |
| 234 |
<xsl:when test="$term-width = ''"> |
| 235 |
<xsl:value-of select="$glossterm.width"/> |
| 236 |
</xsl:when> |
| 237 |
<xsl:otherwise> |
| 238 |
<xsl:value-of select="$term-width"/> |
| 239 |
</xsl:otherwise> |
| 240 |
</xsl:choose> |
| 241 |
</xsl:variable> |
| 242 |
|
| 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"/> |
| 245 |
</xsl:if> |
| 246 |
|
| 247 |
<xsl:choose> |
| 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"> |
| 252 |
<xsl:choose> |
| 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> |
| 257 |
</xsl:when> |
| 258 |
<xsl:otherwise> |
| 259 |
<xsl:apply-templates select="d:glossentry" mode="glossary.as.list"/> |
| 260 |
</xsl:otherwise> |
| 261 |
</xsl:choose> |
| 262 |
</fo:list-block> |
| 263 |
</xsl:when> |
| 264 |
<xsl:when test="$presentation = 'blocks'"> |
| 265 |
<xsl:choose> |
| 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> |
| 270 |
</xsl:when> |
| 271 |
<xsl:otherwise> |
| 272 |
<xsl:apply-templates select="d:glossentry" mode="glossary.as.blocks"/> |
| 273 |
</xsl:otherwise> |
| 274 |
</xsl:choose> |
| 275 |
</xsl:when> |
| 276 |
<xsl:when test="$glosslist.as.blocks != 0"> |
| 277 |
<xsl:choose> |
| 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> |
| 282 |
</xsl:when> |
| 283 |
<xsl:otherwise> |
| 284 |
<xsl:apply-templates select="d:glossentry" mode="glossary.as.blocks"/> |
| 285 |
</xsl:otherwise> |
| 286 |
</xsl:choose> |
| 287 |
</xsl:when> |
| 288 |
<xsl:otherwise> |
| 289 |
<fo:list-block provisional-distance-between-starts="{$width}" |
| 290 |
provisional-label-separation="{$glossterm.separation}" |
| 291 |
xsl:use-attribute-sets="normal.para.spacing"> |
| 292 |
<xsl:choose> |
| 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> |
| 297 |
</xsl:when> |
| 298 |
<xsl:otherwise> |
| 299 |
<xsl:apply-templates select="d:glossentry" mode="glossary.as.list"/> |
| 300 |
</xsl:otherwise> |
| 301 |
</xsl:choose> |
| 302 |
</fo:list-block> |
| 303 |
</xsl:otherwise> |
| 304 |
</xsl:choose> |
| 305 |
</xsl:template> |
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 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 = ''"> |
| 313 |
<xsl:message> |
| 314 |
<xsl:text>Warning: processing automatic glossary </xsl:text> |
| 315 |
<xsl:text>without a glossary.collection file.</xsl:text> |
| 316 |
</xsl:message> |
| 317 |
</xsl:if> |
| 318 |
|
| 319 |
<xsl:if test="not($collection) and $glossary.collection != ''"> |
| 320 |
<xsl:message> |
| 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> |
| 325 |
</xsl:message> |
| 326 |
</xsl:if> |
| 327 |
|
| 328 |
<xsl:call-template name="make-auto-glossary"/> |
| 329 |
</xsl:template> |
| 330 |
|
| 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 |
| 335 |
or self::d:subtitle |
| 336 |
or self::d:glossdiv |
| 337 |
or self::d:glossentry)]"/> |
| 338 |
|
| 339 |
&setup-language-variable; |
| 340 |
|
| 341 |
<xsl:variable name="id"> |
| 342 |
<xsl:call-template name="object.id"/> |
| 343 |
</xsl:variable> |
| 344 |
|
| 345 |
<xsl:variable name="presentation"> |
| 346 |
<xsl:call-template name="pi.dbfo_glossary-presentation"/> |
| 347 |
</xsl:variable> |
| 348 |
|
| 349 |
<xsl:variable name="term-width"> |
| 350 |
<xsl:call-template name="pi.dbfo_glossterm-width"/> |
| 351 |
</xsl:variable> |
| 352 |
|
| 353 |
<xsl:variable name="width"> |
| 354 |
<xsl:choose> |
| 355 |
<xsl:when test="$term-width = ''"> |
| 356 |
<xsl:value-of select="$glossterm.width"/> |
| 357 |
</xsl:when> |
| 358 |
<xsl:otherwise> |
| 359 |
<xsl:value-of select="$term-width"/> |
| 360 |
</xsl:otherwise> |
| 361 |
</xsl:choose> |
| 362 |
</xsl:variable> |
| 363 |
|
| 364 |
<xsl:if test="$glossary.collection = ''"> |
| 365 |
<xsl:message> |
| 366 |
<xsl:text>Warning: processing automatic glossary </xsl:text> |
| 367 |
<xsl:text>without a glossary.collection file.</xsl:text> |
| 368 |
</xsl:message> |
| 369 |
</xsl:if> |
| 370 |
|
| 371 |
<fo:block id="{$id}"> |
| 372 |
<xsl:call-template name="glossary.titlepage"/> |
| 373 |
</fo:block> |
| 374 |
|
| 375 |
<xsl:if test="$preamble"> |
| 376 |
<xsl:apply-templates select="$preamble"/> |
| 377 |
</xsl:if> |
| 378 |
|
| 379 |
<xsl:choose> |
| 380 |
<xsl:when test="d:glossdiv and $collection//d:glossdiv"> |
| 381 |
<xsl:for-each select="$collection//d:glossdiv"> |
| 382 |
|
| 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"/> |
| 388 |
</xsl:if> |
| 389 |
</xsl:for-each> |
| 390 |
</xsl:variable> |
| 391 |
|
| 392 |
<xsl:if test="$exist.test != ''"> |
| 393 |
<xsl:choose> |
| 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> |
| 399 |
</xsl:when> |
| 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> |
| 404 |
</xsl:when> |
| 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> |
| 409 |
</xsl:when> |
| 410 |
<xsl:otherwise> |
| 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> |
| 415 |
</xsl:otherwise> |
| 416 |
</xsl:choose> |
| 417 |
</xsl:if> |
| 418 |
</xsl:for-each> |
| 419 |
</xsl:when> |
| 420 |
<xsl:otherwise> |
| 421 |
<xsl:choose> |
| 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"> |
| 426 |
<xsl:choose> |
| 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"/> |
| 434 |
</xsl:if> |
| 435 |
</xsl:for-each> |
| 436 |
</xsl:when> |
| 437 |
<xsl:otherwise> |
| 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"/> |
| 443 |
</xsl:if> |
| 444 |
</xsl:for-each> |
| 445 |
</xsl:otherwise> |
| 446 |
</xsl:choose> |
| 447 |
</fo:list-block> |
| 448 |
</xsl:when> |
| 449 |
<xsl:when test="$presentation = 'blocks' or |
| 450 |
$glossary.as.blocks != 0"> |
| 451 |
<xsl:choose> |
| 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"/> |
| 459 |
</xsl:if> |
| 460 |
</xsl:for-each> |
| 461 |
</xsl:when> |
| 462 |
<xsl:otherwise> |
| 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"/> |
| 468 |
</xsl:if> |
| 469 |
</xsl:for-each> |
| 470 |
</xsl:otherwise> |
| 471 |
</xsl:choose> |
| 472 |
</xsl:when> |
| 473 |
<xsl:otherwise> |
| 474 |
<fo:list-block provisional-distance-between-starts="{$width}" |
| 475 |
provisional-label-separation="{$glossterm.separation}" |
| 476 |
xsl:use-attribute-sets="normal.para.spacing"> |
| 477 |
<xsl:choose> |
| 478 |
<xsl:when test="$glossary.sort != 0"> |
| 479 |
<xsl:for-each select="$collection//d:glossentry"> |
| 480 |
|
| 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"/> |
| 486 |
</xsl:if> |
| 487 |
</xsl:for-each> |
| 488 |
</xsl:when> |
| 489 |
<xsl:otherwise> |
| 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"/> |
| 495 |
</xsl:if> |
| 496 |
</xsl:for-each> |
| 497 |
</xsl:otherwise> |
| 498 |
</xsl:choose> |
| 499 |
</fo:list-block> |
| 500 |
</xsl:otherwise> |
| 501 |
</xsl:choose> |
| 502 |
</xsl:otherwise> |
| 503 |
</xsl:choose> |
| 504 |
</xsl:template> |
| 505 |
|
| 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> |
| 510 |
|
| 511 |
<xsl:variable name="master-reference"> |
| 512 |
<xsl:call-template name="select.pagemaster"/> |
| 513 |
</xsl:variable> |
| 514 |
|
| 515 |
<xsl:if test="$glossary.collection = ''"> |
| 516 |
<xsl:message> |
| 517 |
<xsl:text>Warning: processing automatic glossary </xsl:text> |
| 518 |
<xsl:text>without a glossary.collection file.</xsl:text> |
| 519 |
</xsl:message> |
| 520 |
</xsl:if> |
| 521 |
|
| 522 |
<fo:page-sequence hyphenate="{$hyphenate}" |
| 523 |
master-reference="{$master-reference}"> |
| 524 |
<xsl:attribute name="language"> |
| 525 |
<xsl:call-template name="l10n.language"/> |
| 526 |
</xsl:attribute> |
| 527 |
<xsl:attribute name="format"> |
| 528 |
<xsl:call-template name="page.number.format"> |
| 529 |
<xsl:with-param name="master-reference" select="$master-reference"/> |
| 530 |
</xsl:call-template> |
| 531 |
</xsl:attribute> |
| 532 |
|
| 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"/> |
| 536 |
</xsl:call-template> |
| 537 |
</xsl:attribute> |
| 538 |
|
| 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"/> |
| 542 |
</xsl:call-template> |
| 543 |
</xsl:attribute> |
| 544 |
|
| 545 |
<xsl:attribute name="hyphenation-character"> |
| 546 |
<xsl:call-template name="gentext"> |
| 547 |
<xsl:with-param name="key" select="'hyphenation-character'"/> |
| 548 |
</xsl:call-template> |
| 549 |
</xsl:attribute> |
| 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'"/> |
| 553 |
</xsl:call-template> |
| 554 |
</xsl:attribute> |
| 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'"/> |
| 558 |
</xsl:call-template> |
| 559 |
</xsl:attribute> |
| 560 |
|
| 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> |
| 567 |
|
| 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"/> |
| 572 |
</xsl:call-template> |
| 573 |
|
| 574 |
<xsl:call-template name="make-auto-glossary"/> |
| 575 |
</fo:flow> |
| 576 |
</fo:page-sequence> |
| 577 |
</xsl:template> |
| 578 |
|
| 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="."/> |
| 582 |
|
| 583 |
&setup-language-variable; |
| 584 |
|
| 585 |
<xsl:variable name="id"> |
| 586 |
<xsl:call-template name="object.id"/> |
| 587 |
</xsl:variable> |
| 588 |
|
| 589 |
<xsl:variable name="preamble" |
| 590 |
select="*[not(self::d:title |
| 591 |
or self::d:subtitle |
| 592 |
or self::d:glossentry)]"/> |
| 593 |
|
| 594 |
<fo:block id="{$id}"> |
| 595 |
<xsl:call-template name="glossdiv.titlepage"/> |
| 596 |
</fo:block> |
| 597 |
|
| 598 |
<xsl:apply-templates select="$preamble"/> |
| 599 |
|
| 600 |
<fo:list-block provisional-distance-between-starts="{$width}" |
| 601 |
provisional-label-separation="{$glossterm.separation}" |
| 602 |
xsl:use-attribute-sets="normal.para.spacing"> |
| 603 |
<xsl:choose> |
| 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"/> |
| 610 |
</xsl:if> |
| 611 |
</xsl:for-each> |
| 612 |
</xsl:when> |
| 613 |
<xsl:otherwise> |
| 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"/> |
| 618 |
</xsl:if> |
| 619 |
</xsl:for-each> |
| 620 |
</xsl:otherwise> |
| 621 |
</xsl:choose> |
| 622 |
</fo:list-block> |
| 623 |
</xsl:template> |
| 624 |
|
| 625 |
<xsl:template match="d:glossentry" mode="auto-glossary-as-list"> |
| 626 |
<xsl:apply-templates select="." mode="glossary.as.list"/> |
| 627 |
</xsl:template> |
| 628 |
|
| 629 |
<xsl:template match="d:glossdiv" mode="auto-glossary-as-blocks"> |
| 630 |
<xsl:param name="terms" select="."/> |
| 631 |
|
| 632 |
&setup-language-variable; |
| 633 |
|
| 634 |
<xsl:variable name="id"> |
| 635 |
<xsl:call-template name="object.id"/> |
| 636 |
</xsl:variable> |
| 637 |
|
| 638 |
<xsl:variable name="preamble" |
| 639 |
select="*[not(self::d:title |
| 640 |
or self::d:subtitle |
| 641 |
or self::d:glossentry)]"/> |
| 642 |
|
| 643 |
<fo:block id="{$id}"> |
| 644 |
<xsl:call-template name="glossdiv.titlepage"/> |
| 645 |
</fo:block> |
| 646 |
|
| 647 |
<xsl:apply-templates select="$preamble"/> |
| 648 |
|
| 649 |
<xsl:choose> |
| 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"/> |
| 656 |
</xsl:if> |
| 657 |
</xsl:for-each> |
| 658 |
</xsl:when> |
| 659 |
<xsl:otherwise> |
| 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"/> |
| 664 |
</xsl:if> |
| 665 |
</xsl:for-each> |
| 666 |
</xsl:otherwise> |
| 667 |
</xsl:choose> |
| 668 |
|
| 669 |
</xsl:template> |
| 670 |
|
| 671 |
<xsl:template match="d:glossentry" mode="auto-glossary-as-blocks"> |
| 672 |
<xsl:apply-templates select="." mode="glossary.as.blocks"/> |
| 673 |
</xsl:template> |
| 674 |
|
| 675 |
|
| 676 |
|
| 677 |
|
| 678 |
<xsl:template match="d:glossdiv" mode="glossary.as.list"> |
| 679 |
<xsl:param name="width" select="$glossterm.width"/> |
| 680 |
|
| 681 |
&setup-language-variable; |
| 682 |
|
| 683 |
<xsl:variable name="id"> |
| 684 |
<xsl:call-template name="object.id"/> |
| 685 |
</xsl:variable> |
| 686 |
|
| 687 |
<xsl:variable name="entries" select="d:glossentry"/> |
| 688 |
|
| 689 |
<xsl:variable name="preamble" |
| 690 |
select="*[not(self::d:title |
| 691 |
or self::d:subtitle |
| 692 |
or self::d:glossentry)]"/> |
| 693 |
|
| 694 |
<fo:block id="{$id}"> |
| 695 |
<xsl:call-template name="glossdiv.titlepage"/> |
| 696 |
</fo:block> |
| 697 |
|
| 698 |
<xsl:apply-templates select="$preamble"/> |
| 699 |
|
| 700 |
<fo:list-block provisional-distance-between-starts="{$width}" |
| 701 |
provisional-label-separation="{$glossterm.separation}" |
| 702 |
xsl:use-attribute-sets="normal.para.spacing"> |
| 703 |
<xsl:choose> |
| 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> |
| 708 |
</xsl:when> |
| 709 |
<xsl:otherwise> |
| 710 |
<xsl:apply-templates select="$entries" mode="glossary.as.list"/> |
| 711 |
</xsl:otherwise> |
| 712 |
</xsl:choose> |
| 713 |
</fo:list-block> |
| 714 |
</xsl:template> |
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
|
| 719 |
|
| 720 |
|
| 721 |
|
| 722 |
|
| 723 |
|
| 724 |
<xsl:template match="d:glossentry" mode="glossary.as.list"> |
| 725 |
<xsl:variable name="id"> |
| 726 |
<xsl:call-template name="object.id"/> |
| 727 |
</xsl:variable> |
| 728 |
|
| 729 |
<fo:list-item xsl:use-attribute-sets="glossentry.list.item.properties"> |
| 730 |
<xsl:call-template name="anchor"> |
| 731 |
<xsl:with-param name="conditional"> |
| 732 |
<xsl:choose> |
| 733 |
<xsl:when test="$glossterm.auto.link != 0 |
| 734 |
or $glossary.collection != ''">0</xsl:when> |
| 735 |
<xsl:otherwise>1</xsl:otherwise> |
| 736 |
</xsl:choose> |
| 737 |
</xsl:with-param> |
| 738 |
</xsl:call-template> |
| 739 |
|
| 740 |
<fo:list-item-label end-indent="label-end()"> |
| 741 |
<fo:block xsl:use-attribute-sets="glossterm.list.properties"> |
| 742 |
<xsl:choose> |
| 743 |
<xsl:when test="$glossentry.show.acronym = 'primary'"> |
| 744 |
<xsl:choose> |
| 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> |
| 752 |
</xsl:when> |
| 753 |
<xsl:otherwise> |
| 754 |
<xsl:apply-templates select="d:glossterm" |
| 755 |
mode="glossary.as.list"/> |
| 756 |
</xsl:otherwise> |
| 757 |
</xsl:choose> |
| 758 |
</xsl:when> |
| 759 |
|
| 760 |
<xsl:when test="$glossentry.show.acronym = 'yes'"> |
| 761 |
<xsl:apply-templates select="d:glossterm" mode="glossary.as.list"/> |
| 762 |
|
| 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> |
| 768 |
</xsl:if> |
| 769 |
</xsl:when> |
| 770 |
|
| 771 |
<xsl:otherwise> |
| 772 |
<xsl:apply-templates select="d:glossterm" mode="glossary.as.list"/> |
| 773 |
</xsl:otherwise> |
| 774 |
</xsl:choose> |
| 775 |
<xsl:apply-templates select="d:indexterm"/> |
| 776 |
</fo:block> |
| 777 |
</fo:list-item-label> |
| 778 |
|
| 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"/> |
| 782 |
</fo:block> |
| 783 |
</fo:list-item-body> |
| 784 |
</fo:list-item> |
| 785 |
</xsl:template> |
| 786 |
|
| 787 |
<xsl:template match="d:glossentry/d:glossterm" mode="glossary.as.list"> |
| 788 |
<xsl:variable name="id"> |
| 789 |
<xsl:call-template name="object.id"/> |
| 790 |
</xsl:variable> |
| 791 |
<fo:inline id="{$id}"> |
| 792 |
<xsl:apply-templates/> |
| 793 |
</fo:inline> |
| 794 |
<xsl:if test="following-sibling::d:glossterm">, </xsl:if> |
| 795 |
</xsl:template> |
| 796 |
|
| 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> |
| 800 |
</xsl:template> |
| 801 |
|
| 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> |
| 805 |
</xsl:template> |
| 806 |
|
| 807 |
<xsl:template match="d:glossentry/d:revhistory" mode="glossary.as.list"> |
| 808 |
</xsl:template> |
| 809 |
|
| 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"/> |
| 815 |
|
| 816 |
<fo:block> |
| 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'"/> |
| 821 |
</xsl:call-template> |
| 822 |
</xsl:variable> |
| 823 |
<xsl:variable name="title"> |
| 824 |
<xsl:choose> |
| 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"/> |
| 829 |
</fo:basic-link> |
| 830 |
</xsl:when> |
| 831 |
<xsl:when test="$xlink"> |
| 832 |
<xsl:call-template name="simple.xlink"> |
| 833 |
<xsl:with-param name="content"> |
| 834 |
<xsl:apply-templates/> |
| 835 |
</xsl:with-param> |
| 836 |
</xsl:call-template> |
| 837 |
</xsl:when> |
| 838 |
<xsl:when test="$otherterm != '' and not($target)"> |
| 839 |
<xsl:message> |
| 840 |
<xsl:text>Warning: glosssee @otherterm reference not found: </xsl:text> |
| 841 |
<xsl:value-of select="$otherterm"/> |
| 842 |
</xsl:message> |
| 843 |
<xsl:apply-templates mode="glossary.as.list"/> |
| 844 |
</xsl:when> |
| 845 |
<xsl:otherwise> |
| 846 |
<xsl:apply-templates mode="glossary.as.list"/> |
| 847 |
</xsl:otherwise> |
| 848 |
</xsl:choose> |
| 849 |
</xsl:variable> |
| 850 |
<xsl:call-template name="substitute-markup"> |
| 851 |
<xsl:with-param name="template" select="$template"/> |
| 852 |
<xsl:with-param name="title" select="$title"/> |
| 853 |
</xsl:call-template> |
| 854 |
</fo:block> |
| 855 |
</xsl:template> |
| 856 |
|
| 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"> |
| 860 |
<fo:block> |
| 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'"/> |
| 865 |
</xsl:call-template> |
| 866 |
</xsl:variable> |
| 867 |
<xsl:variable name="title"> |
| 868 |
<xsl:apply-templates select="d:glossseealso" mode="glossary.as.list"/> |
| 869 |
</xsl:variable> |
| 870 |
<xsl:call-template name="substitute-markup"> |
| 871 |
<xsl:with-param name="template" select="$template"/> |
| 872 |
<xsl:with-param name="title" select="$title"/> |
| 873 |
</xsl:call-template> |
| 874 |
</fo:block> |
| 875 |
</xsl:if> |
| 876 |
</xsl:template> |
| 877 |
|
| 878 |
<xsl:template match="d:glossentry/d:glossdef/d:para[1]|d:glossentry/d:glossdef/d:simpara[1]" |
| 879 |
mode="glossary.as.list"> |
| 880 |
<fo:block> |
| 881 |
<xsl:apply-templates/> |
| 882 |
</fo:block> |
| 883 |
</xsl:template> |
| 884 |
|
| 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"/> |
| 890 |
|
| 891 |
<xsl:choose> |
| 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"/> |
| 896 |
</fo:basic-link> |
| 897 |
</xsl:when> |
| 898 |
<xsl:when test="$xlink"> |
| 899 |
<xsl:call-template name="simple.xlink"> |
| 900 |
<xsl:with-param name="content"> |
| 901 |
<xsl:apply-templates/> |
| 902 |
</xsl:with-param> |
| 903 |
</xsl:call-template> |
| 904 |
</xsl:when> |
| 905 |
<xsl:when test="$otherterm != '' and not($target)"> |
| 906 |
<xsl:message> |
| 907 |
<xsl:text>Warning: glossseealso @otherterm reference not found: </xsl:text> |
| 908 |
<xsl:value-of select="$otherterm"/> |
| 909 |
</xsl:message> |
| 910 |
<xsl:apply-templates mode="glossary.as.list"/> |
| 911 |
</xsl:when> |
| 912 |
<xsl:otherwise> |
| 913 |
<xsl:apply-templates mode="glossary.as.list"/> |
| 914 |
</xsl:otherwise> |
| 915 |
</xsl:choose> |
| 916 |
|
| 917 |
<xsl:choose> |
| 918 |
<xsl:when test="position() = last()"/> |
| 919 |
<xsl:otherwise> |
| 920 |
<xsl:call-template name="gentext.template"> |
| 921 |
<xsl:with-param name="context" select="'glossary'"/> |
| 922 |
<xsl:with-param name="name" select="'seealso-separator'"/> |
| 923 |
</xsl:call-template> |
| 924 |
</xsl:otherwise> |
| 925 |
</xsl:choose> |
| 926 |
</xsl:template> |
| 927 |
|
| 928 |
|
| 929 |
|
| 930 |
|
| 931 |
<xsl:template match="d:glossdiv" mode="glossary.as.blocks"> |
| 932 |
&setup-language-variable; |
| 933 |
|
| 934 |
<xsl:variable name="id"> |
| 935 |
<xsl:call-template name="object.id"/> |
| 936 |
</xsl:variable> |
| 937 |
|
| 938 |
<xsl:variable name="entries" select="d:glossentry"/> |
| 939 |
<xsl:variable name="preamble" |
| 940 |
select="*[not(self::d:title |
| 941 |
or self::d:subtitle |
| 942 |
or self::d:glossentry)]"/> |
| 943 |
|
| 944 |
<fo:block id="{$id}"> |
| 945 |
<xsl:call-template name="glossdiv.titlepage"/> |
| 946 |
</fo:block> |
| 947 |
|
| 948 |
<xsl:apply-templates select="$preamble"/> |
| 949 |
|
| 950 |
<xsl:choose> |
| 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> |
| 955 |
</xsl:when> |
| 956 |
<xsl:otherwise> |
| 957 |
<xsl:apply-templates select="$entries" mode="glossary.as.blocks"/> |
| 958 |
</xsl:otherwise> |
| 959 |
</xsl:choose> |
| 960 |
</xsl:template> |
| 961 |
|
| 962 |
|
| 963 |
|
| 964 |
|
| 965 |
|
| 966 |
|
| 967 |
|
| 968 |
|
| 969 |
|
| 970 |
<xsl:template match="d:glossentry" mode="glossary.as.blocks"> |
| 971 |
<xsl:variable name="id"> |
| 972 |
<xsl:call-template name="object.id"/> |
| 973 |
</xsl:variable> |
| 974 |
|
| 975 |
<fo:block xsl:use-attribute-sets="glossterm.block.properties"> |
| 976 |
<xsl:call-template name="anchor"> |
| 977 |
<xsl:with-param name="conditional"> |
| 978 |
<xsl:choose> |
| 979 |
<xsl:when test="$glossterm.auto.link != 0 |
| 980 |
or $glossary.collection != ''">0</xsl:when> |
| 981 |
<xsl:otherwise>1</xsl:otherwise> |
| 982 |
</xsl:choose> |
| 983 |
</xsl:with-param> |
| 984 |
</xsl:call-template> |
| 985 |
|
| 986 |
<xsl:choose> |
| 987 |
<xsl:when test="$glossentry.show.acronym = 'primary'"> |
| 988 |
<xsl:choose> |
| 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> |
| 994 |
</xsl:when> |
| 995 |
<xsl:otherwise> |
| 996 |
<xsl:apply-templates select="d:glossterm" mode="glossary.as.blocks"/> |
| 997 |
</xsl:otherwise> |
| 998 |
</xsl:choose> |
| 999 |
</xsl:when> |
| 1000 |
|
| 1001 |
<xsl:when test="$glossentry.show.acronym = 'yes'"> |
| 1002 |
<xsl:apply-templates select="d:glossterm" mode="glossary.as.blocks"/> |
| 1003 |
|
| 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> |
| 1008 |
</xsl:if> |
| 1009 |
</xsl:when> |
| 1010 |
|
| 1011 |
<xsl:otherwise> |
| 1012 |
<xsl:apply-templates select="d:glossterm" mode="glossary.as.blocks"/> |
| 1013 |
</xsl:otherwise> |
| 1014 |
</xsl:choose> |
| 1015 |
|
| 1016 |
<xsl:apply-templates select="d:indexterm"/> |
| 1017 |
</fo:block> |
| 1018 |
|
| 1019 |
<fo:block xsl:use-attribute-sets="glossdef.block.properties"> |
| 1020 |
<xsl:apply-templates select="d:glosssee|d:glossdef" mode="glossary.as.blocks"/> |
| 1021 |
</fo:block> |
| 1022 |
</xsl:template> |
| 1023 |
|
| 1024 |
<xsl:template match="d:glossentry/d:glossterm" mode="glossary.as.blocks"> |
| 1025 |
<xsl:variable name="id"> |
| 1026 |
<xsl:call-template name="object.id"/> |
| 1027 |
</xsl:variable> |
| 1028 |
<fo:inline id="{$id}"> |
| 1029 |
<xsl:apply-templates/> |
| 1030 |
</fo:inline> |
| 1031 |
<xsl:if test="following-sibling::d:glossterm">, </xsl:if> |
| 1032 |
</xsl:template> |
| 1033 |
|
| 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> |
| 1037 |
</xsl:template> |
| 1038 |
|
| 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> |
| 1042 |
</xsl:template> |
| 1043 |
|
| 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"/> |
| 1049 |
|
| 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> |
| 1055 |
</xsl:variable> |
| 1056 |
<xsl:variable name="title"> |
| 1057 |
<xsl:choose> |
| 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"/> |
| 1062 |
</fo:basic-link> |
| 1063 |
</xsl:when> |
| 1064 |
<xsl:when test="$xlink"> |
| 1065 |
<xsl:call-template name="simple.xlink"> |
| 1066 |
<xsl:with-param name="content"> |
| 1067 |
<xsl:apply-templates/> |
| 1068 |
</xsl:with-param> |
| 1069 |
</xsl:call-template> |
| 1070 |
</xsl:when> |
| 1071 |
<xsl:when test="$otherterm != '' and not($target)"> |
| 1072 |
<xsl:message> |
| 1073 |
<xsl:text>Warning: glosssee @otherterm reference not found: </xsl:text> |
| 1074 |
<xsl:value-of select="$otherterm"/> |
| 1075 |
</xsl:message> |
| 1076 |
<xsl:apply-templates mode="glossary.as.blocks"/> |
| 1077 |
</xsl:when> |
| 1078 |
<xsl:otherwise> |
| 1079 |
<xsl:apply-templates mode="glossary.as.blocks"/> |
| 1080 |
</xsl:otherwise> |
| 1081 |
</xsl:choose> |
| 1082 |
</xsl:variable> |
| 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> |
| 1087 |
</xsl:template> |
| 1088 |
|
| 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"> |
| 1093 |
<fo:block> |
| 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> |
| 1099 |
</xsl:variable> |
| 1100 |
<xsl:variable name="title"> |
| 1101 |
<xsl:apply-templates select="d:glossseealso" mode="glossary.as.blocks"/> |
| 1102 |
</xsl:variable> |
| 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> |
| 1107 |
</fo:block> |
| 1108 |
</xsl:if> |
| 1109 |
</xsl:template> |
| 1110 |
|
| 1111 |
<xsl:template match="d:glossentry/d:glossdef/d:para[1]|d:glossentry/d:glossdef/d:simpara[1]" |
| 1112 |
mode="glossary.as.blocks"> |
| 1113 |
<fo:block> |
| 1114 |
<xsl:apply-templates/> |
| 1115 |
</fo:block> |
| 1116 |
</xsl:template> |
| 1117 |
|
| 1118 |
|
| 1119 |
<xsl:template match="*" mode="glossary.as.blocks"> |
| 1120 |
<xsl:apply-templates select="." /> |
| 1121 |
</xsl:template> |
| 1122 |
|
| 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"/> |
| 1128 |
|
| 1129 |
<xsl:choose> |
| 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"/> |
| 1134 |
</fo:basic-link> |
| 1135 |
</xsl:when> |
| 1136 |
<xsl:when test="$xlink"> |
| 1137 |
<xsl:call-template name="simple.xlink"> |
| 1138 |
<xsl:with-param name="content"> |
| 1139 |
<xsl:apply-templates/> |
| 1140 |
</xsl:with-param> |
| 1141 |
</xsl:call-template> |
| 1142 |
</xsl:when> |
| 1143 |
<xsl:when test="$otherterm != '' and not($target)"> |
| 1144 |
<xsl:message> |
| 1145 |
<xsl:text>Warning: glossseealso @otherterm reference not found: </xsl:text> |
| 1146 |
<xsl:value-of select="$otherterm"/> |
| 1147 |
</xsl:message> |
| 1148 |
<xsl:apply-templates mode="glossary.as.blocks"/> |
| 1149 |
</xsl:when> |
| 1150 |
<xsl:otherwise> |
| 1151 |
<xsl:apply-templates mode="glossary.as.blocks"/> |
| 1152 |
</xsl:otherwise> |
| 1153 |
</xsl:choose> |
| 1154 |
|
| 1155 |
<xsl:choose> |
| 1156 |
<xsl:when test="position() = last()"/> |
| 1157 |
<xsl:otherwise> |
| 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> |
| 1162 |
</xsl:otherwise> |
| 1163 |
</xsl:choose> |
| 1164 |
</xsl:template> |
| 1165 |
|
| 1166 |
|
| 1167 |
|
| 1168 |
</xsl:stylesheet> |