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