[c873d807] | 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:fo="http://www.w3.org/1999/XSL/Format"
|
---|
| 8 | xmlns:rx="http://www.renderx.com/XSL/Extensions"
|
---|
| 9 | xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions"
|
---|
| 10 | xmlns:exslt="http://exslt.org/common"
|
---|
| 11 | extension-element-prefixes="exslt"
|
---|
| 12 | exclude-result-prefixes="exslt"
|
---|
| 13 | version="1.0">
|
---|
| 14 |
|
---|
| 15 | <!-- ********************************************************************
|
---|
[15c7d39] | 16 | $Id: autoidx.xsl 9647 2012-10-26 17:42:03Z bobstayton $
|
---|
[c873d807] | 17 | ********************************************************************
|
---|
| 18 |
|
---|
| 19 | This file is part of the DocBook XSL Stylesheet distribution.
|
---|
| 20 | See ../README or http://docbook.sf.net/ for copyright
|
---|
| 21 | copyright and other information.
|
---|
| 22 |
|
---|
| 23 | ******************************************************************** -->
|
---|
| 24 |
|
---|
| 25 | <!-- ==================================================================== -->
|
---|
| 26 | <!-- The "basic" method derived from Jeni Tennison's work. -->
|
---|
| 27 | <!-- The "kosek" method contributed by Jirka Kosek. -->
|
---|
| 28 | <!-- The "kimber" method contributed by Eliot Kimber of Innodata Isogen. -->
|
---|
| 29 |
|
---|
| 30 | <!-- Importing module for kimber or kosek method overrides one of these -->
|
---|
| 31 | <xsl:param name="kimber.imported" select="0"/>
|
---|
| 32 | <xsl:param name="kosek.imported" select="0"/>
|
---|
| 33 |
|
---|
| 34 | <!-- These keys used primary in all methods -->
|
---|
| 35 | <xsl:key name="letter"
|
---|
| 36 | match="indexterm"
|
---|
| 37 | use="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
|
---|
| 38 |
|
---|
| 39 | <xsl:key name="primary"
|
---|
| 40 | match="indexterm"
|
---|
| 41 | use="&primary;"/>
|
---|
| 42 |
|
---|
| 43 | <xsl:key name="secondary"
|
---|
| 44 | match="indexterm"
|
---|
| 45 | use="concat(&primary;, &sep;, &secondary;)"/>
|
---|
| 46 |
|
---|
| 47 | <xsl:key name="tertiary"
|
---|
| 48 | match="indexterm"
|
---|
| 49 | use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;)"/>
|
---|
| 50 |
|
---|
| 51 | <xsl:key name="endofrange"
|
---|
| 52 | match="indexterm[@class='endofrange']"
|
---|
| 53 | use="@startref"/>
|
---|
| 54 |
|
---|
| 55 | <xsl:key name="see-also"
|
---|
| 56 | match="indexterm[seealso]"
|
---|
| 57 | use="concat(&primary;, &sep;,
|
---|
| 58 | &secondary;, &sep;,
|
---|
| 59 | &tertiary;, &sep;, seealso)"/>
|
---|
| 60 |
|
---|
| 61 | <xsl:key name="see"
|
---|
| 62 | match="indexterm[see]"
|
---|
| 63 | use="concat(&primary;, &sep;,
|
---|
| 64 | &secondary;, &sep;,
|
---|
| 65 | &tertiary;, &sep;, see)"/>
|
---|
| 66 |
|
---|
| 67 |
|
---|
| 68 | <xsl:template name="generate-index">
|
---|
| 69 | <xsl:param name="scope" select="(ancestor::book|/)[last()]"/>
|
---|
| 70 |
|
---|
| 71 | <xsl:choose>
|
---|
| 72 | <xsl:when test="$index.method = 'kosek'">
|
---|
| 73 | <xsl:call-template name="generate-kosek-index">
|
---|
| 74 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 75 | </xsl:call-template>
|
---|
| 76 | </xsl:when>
|
---|
| 77 | <xsl:when test="$index.method = 'kimber'">
|
---|
| 78 | <xsl:call-template name="generate-kimber-index">
|
---|
| 79 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 80 | </xsl:call-template>
|
---|
| 81 | </xsl:when>
|
---|
| 82 |
|
---|
| 83 | <xsl:otherwise>
|
---|
| 84 | <xsl:call-template name="generate-basic-index">
|
---|
| 85 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 86 | </xsl:call-template>
|
---|
| 87 | </xsl:otherwise>
|
---|
| 88 | </xsl:choose>
|
---|
| 89 | </xsl:template>
|
---|
| 90 |
|
---|
| 91 | <xsl:template name="generate-basic-index">
|
---|
| 92 | <xsl:param name="scope" select="NOTANODE"/>
|
---|
| 93 |
|
---|
| 94 | <xsl:variable name="role">
|
---|
| 95 | <xsl:if test="$index.on.role != 0">
|
---|
| 96 | <xsl:value-of select="@role"/>
|
---|
| 97 | </xsl:if>
|
---|
| 98 | </xsl:variable>
|
---|
| 99 |
|
---|
| 100 | <xsl:variable name="type">
|
---|
| 101 | <xsl:if test="$index.on.type != 0">
|
---|
| 102 | <xsl:value-of select="@type"/>
|
---|
| 103 | </xsl:if>
|
---|
| 104 | </xsl:variable>
|
---|
| 105 |
|
---|
| 106 | <xsl:variable name="terms"
|
---|
| 107 | select="//indexterm
|
---|
| 108 | [count(.|key('letter',
|
---|
| 109 | translate(substring(&primary;, 1, 1),
|
---|
| 110 | &lowercase;,
|
---|
| 111 | &uppercase;))
|
---|
| 112 | [&scope;][1]) = 1
|
---|
| 113 | and not(@class = 'endofrange')]"/>
|
---|
| 114 |
|
---|
| 115 | <xsl:variable name="alphabetical"
|
---|
| 116 | select="$terms[contains(concat(&lowercase;, &uppercase;),
|
---|
| 117 | substring(&primary;, 1, 1))]"/>
|
---|
| 118 |
|
---|
| 119 | <xsl:variable name="others" select="$terms[not(contains(
|
---|
| 120 | concat(&lowercase;,
|
---|
| 121 | &uppercase;),
|
---|
| 122 | substring(&primary;, 1, 1)))]"/>
|
---|
| 123 | <fo:block>
|
---|
| 124 | <xsl:if test="$others">
|
---|
| 125 | <xsl:call-template name="indexdiv.title">
|
---|
| 126 | <xsl:with-param name="titlecontent">
|
---|
| 127 | <xsl:call-template name="gentext">
|
---|
| 128 | <xsl:with-param name="key" select="'index symbols'"/>
|
---|
| 129 | </xsl:call-template>
|
---|
| 130 | </xsl:with-param>
|
---|
| 131 | </xsl:call-template>
|
---|
| 132 |
|
---|
| 133 | <fo:block>
|
---|
| 134 | <xsl:apply-templates select="$others[count(.|key('primary',
|
---|
| 135 | &primary;)[&scope;][1]) = 1]"
|
---|
| 136 | mode="index-symbol-div">
|
---|
| 137 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 138 | <xsl:with-param name="role" select="$role"/>
|
---|
| 139 | <xsl:with-param name="type" select="$type"/>
|
---|
| 140 | <xsl:sort select="translate(&primary;, &lowercase;,
|
---|
| 141 | &uppercase;)"/>
|
---|
| 142 | </xsl:apply-templates>
|
---|
| 143 | </fo:block>
|
---|
| 144 | </xsl:if>
|
---|
| 145 |
|
---|
| 146 | <xsl:apply-templates select="$alphabetical[count(.|key('letter',
|
---|
| 147 | translate(substring(&primary;, 1, 1),
|
---|
| 148 | &lowercase;,&uppercase;))
|
---|
| 149 | [&scope;][1]) = 1]"
|
---|
| 150 | mode="index-div-basic">
|
---|
| 151 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 152 | <xsl:with-param name="role" select="$role"/>
|
---|
| 153 | <xsl:with-param name="type" select="$type"/>
|
---|
| 154 | <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
---|
| 155 | </xsl:apply-templates>
|
---|
| 156 | </fo:block>
|
---|
| 157 | </xsl:template>
|
---|
| 158 |
|
---|
| 159 | <!-- This template not used if fo/autoidx-kosek.xsl is imported -->
|
---|
| 160 | <xsl:template name="generate-kosek-index">
|
---|
| 161 | <xsl:param name="scope" select="NOTANODE"/>
|
---|
| 162 |
|
---|
| 163 | <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
|
---|
| 164 | <xsl:if test="contains($vendor, 'libxslt')">
|
---|
| 165 | <xsl:message terminate="yes">
|
---|
| 166 | <xsl:text>ERROR: the 'kosek' index method does not </xsl:text>
|
---|
| 167 | <xsl:text>work with the xsltproc XSLT processor.</xsl:text>
|
---|
| 168 | </xsl:message>
|
---|
| 169 | </xsl:if>
|
---|
| 170 |
|
---|
| 171 |
|
---|
[15c7d39] | 172 | <xsl:if test="$exsl.node.set.available = 0">
|
---|
[c873d807] | 173 | <xsl:message terminate="yes">
|
---|
| 174 | <xsl:text>ERROR: the 'kosek' index method requires the </xsl:text>
|
---|
| 175 | <xsl:text>exslt:node-set() function. Use a processor that </xsl:text>
|
---|
| 176 | <xsl:text>has it, or use a different index method.</xsl:text>
|
---|
| 177 | </xsl:message>
|
---|
| 178 | </xsl:if>
|
---|
| 179 |
|
---|
| 180 | <xsl:if test="$kosek.imported = 0">
|
---|
| 181 | <xsl:message terminate="yes">
|
---|
| 182 | <xsl:text>ERROR: the 'kosek' index method requires the
</xsl:text>
|
---|
| 183 | <xsl:text>kosek index extensions be imported:
</xsl:text>
|
---|
| 184 | <xsl:text> xsl:import href="fo/autoidx-kosek.xsl"</xsl:text>
|
---|
| 185 | </xsl:message>
|
---|
| 186 | </xsl:if>
|
---|
| 187 |
|
---|
| 188 | </xsl:template>
|
---|
| 189 |
|
---|
| 190 |
|
---|
| 191 | <!-- This template not used if fo/autoidx-kimber.xsl is imported -->
|
---|
| 192 | <xsl:template name="generate-kimber-index">
|
---|
| 193 | <xsl:param name="scope" select="NOTANODE"/>
|
---|
| 194 |
|
---|
| 195 | <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
|
---|
| 196 | <xsl:if test="not(contains($vendor, 'SAXON '))">
|
---|
| 197 | <xsl:message terminate="yes">
|
---|
| 198 | <xsl:text>ERROR: the 'kimber' index method requires the </xsl:text>
|
---|
| 199 | <xsl:text>Saxon version 6 or 8 XSLT processor.</xsl:text>
|
---|
| 200 | </xsl:message>
|
---|
| 201 | </xsl:if>
|
---|
| 202 |
|
---|
| 203 | <xsl:if test="$kimber.imported = 0">
|
---|
| 204 | <xsl:message terminate="yes">
|
---|
| 205 | <xsl:text>ERROR: the 'kimber' index method requires the
</xsl:text>
|
---|
| 206 | <xsl:text>kimber index extensions be imported:
</xsl:text>
|
---|
| 207 | <xsl:text> xsl:import href="fo/autoidx-kimber.xsl"</xsl:text>
|
---|
| 208 | </xsl:message>
|
---|
| 209 | </xsl:if>
|
---|
| 210 |
|
---|
| 211 | </xsl:template>
|
---|
| 212 |
|
---|
| 213 | <xsl:template match="indexterm" mode="index-div-basic">
|
---|
| 214 | <xsl:param name="scope" select="."/>
|
---|
| 215 | <xsl:param name="role" select="''"/>
|
---|
| 216 | <xsl:param name="type" select="''"/>
|
---|
| 217 |
|
---|
| 218 | <xsl:variable name="key"
|
---|
| 219 | select="translate(substring(&primary;, 1, 1),
|
---|
| 220 | &lowercase;,&uppercase;)"/>
|
---|
| 221 |
|
---|
| 222 | <xsl:if test="key('letter', $key)[&scope;]
|
---|
| 223 | [count(.|key('primary', &primary;)[&scope;][1]) = 1]">
|
---|
| 224 | <fo:block>
|
---|
| 225 | <xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)">
|
---|
| 226 | <xsl:call-template name="indexdiv.title">
|
---|
| 227 | <xsl:with-param name="titlecontent">
|
---|
| 228 | <xsl:value-of select="translate($key, &lowercase;, &uppercase;)"/>
|
---|
| 229 | </xsl:with-param>
|
---|
| 230 | </xsl:call-template>
|
---|
| 231 | </xsl:if>
|
---|
| 232 | <fo:block xsl:use-attribute-sets="index.entry.properties">
|
---|
| 233 | <xsl:apply-templates select="key('letter', $key)[&scope;]
|
---|
| 234 | [count(.|key('primary', &primary;)
|
---|
| 235 | [&scope;][1])=1]"
|
---|
| 236 | mode="index-primary">
|
---|
| 237 | <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
---|
| 238 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 239 | <xsl:with-param name="role" select="$role"/>
|
---|
| 240 | <xsl:with-param name="type" select="$type"/>
|
---|
| 241 | </xsl:apply-templates>
|
---|
| 242 | </fo:block>
|
---|
| 243 | </fo:block>
|
---|
| 244 | </xsl:if>
|
---|
| 245 | </xsl:template>
|
---|
| 246 |
|
---|
| 247 | <xsl:template match="indexterm" mode="index-symbol-div">
|
---|
| 248 | <xsl:param name="scope" select="."/>
|
---|
| 249 | <xsl:param name="role" select="''"/>
|
---|
| 250 | <xsl:param name="type" select="''"/>
|
---|
| 251 |
|
---|
| 252 | <xsl:variable name="key"
|
---|
| 253 | select="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
|
---|
| 254 |
|
---|
| 255 | <fo:block xsl:use-attribute-sets="index.entry.properties">
|
---|
| 256 | <xsl:apply-templates select="key('letter', $key)[&scope;][count(.|key('primary', &primary;)[&scope;][1]) = 1]"
|
---|
| 257 | mode="index-primary">
|
---|
| 258 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 259 | <xsl:with-param name="role" select="$role"/>
|
---|
| 260 | <xsl:with-param name="type" select="$type"/>
|
---|
| 261 | <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
---|
| 262 | </xsl:apply-templates>
|
---|
| 263 | </fo:block>
|
---|
| 264 | </xsl:template>
|
---|
| 265 |
|
---|
| 266 | <xsl:template match="indexterm" mode="index-primary">
|
---|
| 267 | <xsl:param name="scope" select="."/>
|
---|
| 268 | <xsl:param name="role" select="''"/>
|
---|
| 269 | <xsl:param name="type" select="''"/>
|
---|
| 270 |
|
---|
| 271 | <xsl:variable name="key" select="&primary;"/>
|
---|
| 272 | <xsl:variable name="refs" select="key('primary', $key)[&scope;]"/>
|
---|
| 273 |
|
---|
| 274 | <xsl:variable name="term.separator">
|
---|
| 275 | <xsl:call-template name="index.separator">
|
---|
| 276 | <xsl:with-param name="key" select="'index.term.separator'"/>
|
---|
| 277 | </xsl:call-template>
|
---|
| 278 | </xsl:variable>
|
---|
| 279 |
|
---|
| 280 | <xsl:variable name="range.separator">
|
---|
| 281 | <xsl:call-template name="index.separator">
|
---|
| 282 | <xsl:with-param name="key" select="'index.range.separator'"/>
|
---|
| 283 | </xsl:call-template>
|
---|
| 284 | </xsl:variable>
|
---|
| 285 |
|
---|
| 286 | <xsl:variable name="number.separator">
|
---|
| 287 | <xsl:call-template name="index.separator">
|
---|
| 288 | <xsl:with-param name="key" select="'index.number.separator'"/>
|
---|
| 289 | </xsl:call-template>
|
---|
| 290 | </xsl:variable>
|
---|
| 291 |
|
---|
| 292 | <fo:block>
|
---|
| 293 | <xsl:if test="$axf.extensions != 0">
|
---|
| 294 | <xsl:attribute name="axf:suppress-duplicate-page-number">true</xsl:attribute>
|
---|
| 295 | </xsl:if>
|
---|
[15c7d39] | 296 |
|
---|
| 297 | <xsl:for-each select="$refs/primary">
|
---|
| 298 | <xsl:if test="@id or @xml:id">
|
---|
| 299 | <fo:inline id="{(@id|@xml:id)[1]}"/>
|
---|
| 300 | </xsl:if>
|
---|
| 301 | </xsl:for-each>
|
---|
| 302 |
|
---|
[c873d807] | 303 | <xsl:value-of select="primary"/>
|
---|
| 304 |
|
---|
| 305 | <xsl:choose>
|
---|
| 306 | <xsl:when test="$xep.extensions != 0">
|
---|
| 307 | <xsl:if test="$refs[not(see) and not(secondary)]">
|
---|
| 308 | <xsl:copy-of select="$term.separator"/>
|
---|
| 309 | <xsl:variable name="primary" select="&primary;"/>
|
---|
| 310 | <xsl:variable name="primary.significant" select="concat(&primary;, $significant.flag)"/>
|
---|
| 311 | <rx:page-index list-separator="{$number.separator}"
|
---|
| 312 | range-separator="{$range.separator}">
|
---|
| 313 | <xsl:if test="$refs[@significance='preferred'][not(see) and not(secondary)]">
|
---|
| 314 | <rx:index-item xsl:use-attribute-sets="index.preferred.page.properties xep.index.item.properties"
|
---|
| 315 | ref-key="{$primary.significant}"/>
|
---|
| 316 | </xsl:if>
|
---|
| 317 | <xsl:if test="$refs[not(@significance) or @significance!='preferred'][not(see) and not(secondary)]">
|
---|
| 318 | <rx:index-item xsl:use-attribute-sets="xep.index.item.properties"
|
---|
| 319 | ref-key="{$primary}"/>
|
---|
| 320 | </xsl:if>
|
---|
| 321 | </rx:page-index>
|
---|
| 322 | </xsl:if>
|
---|
| 323 | </xsl:when>
|
---|
| 324 | <xsl:otherwise>
|
---|
| 325 | <xsl:variable name="page-number-citations">
|
---|
| 326 | <xsl:for-each select="$refs[not(see)
|
---|
| 327 | and not(secondary)]">
|
---|
| 328 | <xsl:apply-templates select="." mode="reference">
|
---|
| 329 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 330 | <xsl:with-param name="role" select="$role"/>
|
---|
| 331 | <xsl:with-param name="type" select="$type"/>
|
---|
| 332 | <xsl:with-param name="position" select="position()"/>
|
---|
| 333 | </xsl:apply-templates>
|
---|
| 334 | </xsl:for-each>
|
---|
| 335 | </xsl:variable>
|
---|
| 336 |
|
---|
[15c7d39] | 337 | <xsl:copy-of select="$page-number-citations"/>
|
---|
[c873d807] | 338 | </xsl:otherwise>
|
---|
| 339 | </xsl:choose>
|
---|
| 340 |
|
---|
| 341 | <xsl:if test="$refs[not(secondary)]/*[self::see]">
|
---|
| 342 | <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &sep;, &sep;, see))[&scope;][1])]"
|
---|
| 343 | mode="index-see">
|
---|
| 344 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 345 | <xsl:with-param name="role" select="$role"/>
|
---|
| 346 | <xsl:with-param name="type" select="$type"/>
|
---|
| 347 | <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
|
---|
| 348 | </xsl:apply-templates>
|
---|
| 349 | </xsl:if>
|
---|
| 350 |
|
---|
| 351 | </fo:block>
|
---|
| 352 |
|
---|
| 353 | <xsl:if test="$refs/secondary or $refs[not(secondary)]/*[self::seealso]">
|
---|
| 354 | <fo:block start-indent="1pc">
|
---|
| 355 | <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &sep;, &sep;, seealso))[&scope;][1])]"
|
---|
| 356 | mode="index-seealso">
|
---|
| 357 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 358 | <xsl:with-param name="role" select="$role"/>
|
---|
| 359 | <xsl:with-param name="type" select="$type"/>
|
---|
| 360 | <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
|
---|
| 361 | </xsl:apply-templates>
|
---|
| 362 | <xsl:apply-templates select="$refs[secondary and count(.|key('secondary', concat($key, &sep;, &secondary;))[&scope;][1]) = 1]"
|
---|
| 363 | mode="index-secondary">
|
---|
| 364 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 365 | <xsl:with-param name="role" select="$role"/>
|
---|
| 366 | <xsl:with-param name="type" select="$type"/>
|
---|
| 367 | <xsl:sort select="translate(&secondary;, &lowercase;, &uppercase;)"/>
|
---|
| 368 | </xsl:apply-templates>
|
---|
| 369 | </fo:block>
|
---|
| 370 | </xsl:if>
|
---|
| 371 | </xsl:template>
|
---|
| 372 |
|
---|
| 373 | <xsl:template match="indexterm" mode="index-secondary">
|
---|
| 374 | <xsl:param name="scope" select="."/>
|
---|
| 375 | <xsl:param name="role" select="''"/>
|
---|
| 376 | <xsl:param name="type" select="''"/>
|
---|
| 377 |
|
---|
| 378 | <xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;)"/>
|
---|
| 379 | <xsl:variable name="refs" select="key('secondary', $key)[&scope;]"/>
|
---|
| 380 |
|
---|
| 381 | <xsl:variable name="term.separator">
|
---|
| 382 | <xsl:call-template name="index.separator">
|
---|
| 383 | <xsl:with-param name="key" select="'index.term.separator'"/>
|
---|
| 384 | </xsl:call-template>
|
---|
| 385 | </xsl:variable>
|
---|
| 386 |
|
---|
| 387 | <xsl:variable name="range.separator">
|
---|
| 388 | <xsl:call-template name="index.separator">
|
---|
| 389 | <xsl:with-param name="key" select="'index.range.separator'"/>
|
---|
| 390 | </xsl:call-template>
|
---|
| 391 | </xsl:variable>
|
---|
| 392 |
|
---|
| 393 | <xsl:variable name="number.separator">
|
---|
| 394 | <xsl:call-template name="index.separator">
|
---|
| 395 | <xsl:with-param name="key" select="'index.number.separator'"/>
|
---|
| 396 | </xsl:call-template>
|
---|
| 397 | </xsl:variable>
|
---|
| 398 |
|
---|
| 399 | <fo:block>
|
---|
| 400 | <xsl:if test="$axf.extensions != 0">
|
---|
| 401 | <xsl:attribute name="axf:suppress-duplicate-page-number">true</xsl:attribute>
|
---|
| 402 | </xsl:if>
|
---|
[15c7d39] | 403 |
|
---|
| 404 | <xsl:for-each select="$refs/secondary">
|
---|
| 405 | <xsl:if test="@id or @xml:id">
|
---|
| 406 | <fo:inline id="{(@id|@xml:id)[1]}"/>
|
---|
| 407 | </xsl:if>
|
---|
| 408 | </xsl:for-each>
|
---|
| 409 |
|
---|
[c873d807] | 410 | <xsl:value-of select="secondary"/>
|
---|
| 411 |
|
---|
| 412 | <xsl:choose>
|
---|
| 413 | <xsl:when test="$xep.extensions != 0">
|
---|
| 414 | <xsl:if test="$refs[not(see) and not(tertiary)]">
|
---|
| 415 | <xsl:copy-of select="$term.separator"/>
|
---|
| 416 | <xsl:variable name="primary" select="&primary;"/>
|
---|
| 417 | <xsl:variable name="secondary" select="&secondary;"/>
|
---|
| 418 | <xsl:variable name="primary.significant" select="concat(&primary;, $significant.flag)"/>
|
---|
| 419 | <rx:page-index list-separator="{$number.separator}"
|
---|
| 420 | range-separator="{$range.separator}">
|
---|
| 421 | <xsl:if test="$refs[@significance='preferred'][not(see) and not(tertiary)]">
|
---|
| 422 | <rx:index-item xsl:use-attribute-sets="index.preferred.page.properties xep.index.item.properties">
|
---|
| 423 | <xsl:attribute name="ref-key">
|
---|
| 424 | <xsl:value-of select="$primary.significant"/>
|
---|
| 425 | <xsl:text>, </xsl:text>
|
---|
| 426 | <xsl:value-of select="$secondary"/>
|
---|
| 427 | </xsl:attribute>
|
---|
| 428 | </rx:index-item>
|
---|
| 429 | </xsl:if>
|
---|
| 430 | <xsl:if test="$refs[not(@significance) or @significance!='preferred'][not(see) and not(tertiary)]">
|
---|
| 431 | <rx:index-item xsl:use-attribute-sets="xep.index.item.properties">
|
---|
| 432 | <xsl:attribute name="ref-key">
|
---|
| 433 | <xsl:value-of select="$primary"/>
|
---|
| 434 | <xsl:text>, </xsl:text>
|
---|
| 435 | <xsl:value-of select="$secondary"/>
|
---|
| 436 | </xsl:attribute>
|
---|
| 437 | </rx:index-item>
|
---|
| 438 | </xsl:if>
|
---|
| 439 | </rx:page-index>
|
---|
| 440 | </xsl:if>
|
---|
| 441 | </xsl:when>
|
---|
| 442 | <xsl:otherwise>
|
---|
| 443 | <xsl:variable name="page-number-citations">
|
---|
| 444 | <xsl:for-each select="$refs[not(see)
|
---|
| 445 | and not(tertiary)]">
|
---|
| 446 | <xsl:apply-templates select="." mode="reference">
|
---|
| 447 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 448 | <xsl:with-param name="role" select="$role"/>
|
---|
| 449 | <xsl:with-param name="type" select="$type"/>
|
---|
| 450 | <xsl:with-param name="position" select="position()"/>
|
---|
| 451 | </xsl:apply-templates>
|
---|
| 452 | </xsl:for-each>
|
---|
| 453 | </xsl:variable>
|
---|
| 454 |
|
---|
[15c7d39] | 455 | <xsl:copy-of select="$page-number-citations"/>
|
---|
[c873d807] | 456 | </xsl:otherwise>
|
---|
| 457 | </xsl:choose>
|
---|
| 458 |
|
---|
| 459 | <xsl:if test="$refs[not(tertiary)]/*[self::see]">
|
---|
| 460 | <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &secondary;, &sep;, &sep;, see))[&scope;][1])]"
|
---|
| 461 | mode="index-see">
|
---|
| 462 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 463 | <xsl:with-param name="role" select="$role"/>
|
---|
| 464 | <xsl:with-param name="type" select="$type"/>
|
---|
| 465 | <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
|
---|
| 466 | </xsl:apply-templates>
|
---|
| 467 | </xsl:if>
|
---|
| 468 |
|
---|
| 469 | </fo:block>
|
---|
| 470 |
|
---|
| 471 | <xsl:if test="$refs/tertiary or $refs[not(tertiary)]/*[self::seealso]">
|
---|
| 472 | <fo:block start-indent="2pc">
|
---|
| 473 | <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &secondary;, &sep;, &sep;, seealso))[&scope;][1])]"
|
---|
| 474 | mode="index-seealso">
|
---|
| 475 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 476 | <xsl:with-param name="role" select="$role"/>
|
---|
| 477 | <xsl:with-param name="type" select="$type"/>
|
---|
| 478 | <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
|
---|
| 479 | </xsl:apply-templates>
|
---|
| 480 | <xsl:apply-templates select="$refs[tertiary and count(.|key('tertiary', concat($key, &sep;, &tertiary;))[&scope;][1]) = 1]"
|
---|
| 481 | mode="index-tertiary">
|
---|
| 482 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 483 | <xsl:with-param name="role" select="$role"/>
|
---|
| 484 | <xsl:with-param name="type" select="$type"/>
|
---|
| 485 | <xsl:sort select="translate(&tertiary;, &lowercase;, &uppercase;)"/>
|
---|
| 486 | </xsl:apply-templates>
|
---|
| 487 | </fo:block>
|
---|
| 488 | </xsl:if>
|
---|
| 489 | </xsl:template>
|
---|
| 490 |
|
---|
| 491 | <xsl:template match="indexterm" mode="index-tertiary">
|
---|
| 492 | <xsl:param name="scope" select="."/>
|
---|
| 493 | <xsl:param name="role" select="''"/>
|
---|
| 494 | <xsl:param name="type" select="''"/>
|
---|
| 495 | <xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;)"/>
|
---|
| 496 | <xsl:variable name="refs" select="key('tertiary', $key)[&scope;]"/>
|
---|
| 497 |
|
---|
| 498 | <xsl:variable name="term.separator">
|
---|
| 499 | <xsl:call-template name="index.separator">
|
---|
| 500 | <xsl:with-param name="key" select="'index.term.separator'"/>
|
---|
| 501 | </xsl:call-template>
|
---|
| 502 | </xsl:variable>
|
---|
| 503 |
|
---|
| 504 | <xsl:variable name="range.separator">
|
---|
| 505 | <xsl:call-template name="index.separator">
|
---|
| 506 | <xsl:with-param name="key" select="'index.range.separator'"/>
|
---|
| 507 | </xsl:call-template>
|
---|
| 508 | </xsl:variable>
|
---|
| 509 |
|
---|
| 510 | <xsl:variable name="number.separator">
|
---|
| 511 | <xsl:call-template name="index.separator">
|
---|
| 512 | <xsl:with-param name="key" select="'index.number.separator'"/>
|
---|
| 513 | </xsl:call-template>
|
---|
| 514 | </xsl:variable>
|
---|
| 515 |
|
---|
| 516 | <fo:block>
|
---|
| 517 | <xsl:if test="$axf.extensions != 0">
|
---|
| 518 | <xsl:attribute name="axf:suppress-duplicate-page-number">true</xsl:attribute>
|
---|
| 519 | </xsl:if>
|
---|
[15c7d39] | 520 |
|
---|
| 521 | <xsl:for-each select="$refs/tertiary">
|
---|
| 522 | <xsl:if test="@id or @xml:id">
|
---|
| 523 | <fo:inline id="{(@id|@xml:id)[1]}"/>
|
---|
| 524 | </xsl:if>
|
---|
| 525 | </xsl:for-each>
|
---|
| 526 |
|
---|
[c873d807] | 527 | <xsl:value-of select="tertiary"/>
|
---|
| 528 |
|
---|
| 529 | <xsl:choose>
|
---|
| 530 | <xsl:when test="$xep.extensions != 0">
|
---|
| 531 | <xsl:if test="$refs[not(see)]">
|
---|
| 532 | <xsl:copy-of select="$term.separator"/>
|
---|
| 533 | <xsl:variable name="primary" select="&primary;"/>
|
---|
| 534 | <xsl:variable name="secondary" select="&secondary;"/>
|
---|
| 535 | <xsl:variable name="tertiary" select="&tertiary;"/>
|
---|
| 536 | <xsl:variable name="primary.significant" select="concat(&primary;, $significant.flag)"/>
|
---|
| 537 | <rx:page-index list-separator="{$number.separator}"
|
---|
| 538 | range-separator="{$range.separator}">
|
---|
| 539 | <xsl:if test="$refs[@significance='preferred'][not(see)]">
|
---|
| 540 | <rx:index-item xsl:use-attribute-sets="index.preferred.page.properties xep.index.item.properties">
|
---|
| 541 | <xsl:attribute name="ref-key">
|
---|
| 542 | <xsl:value-of select="$primary.significant"/>
|
---|
| 543 | <xsl:text>, </xsl:text>
|
---|
| 544 | <xsl:value-of select="$secondary"/>
|
---|
| 545 | <xsl:text>, </xsl:text>
|
---|
| 546 | <xsl:value-of select="$tertiary"/>
|
---|
| 547 | </xsl:attribute>
|
---|
| 548 | </rx:index-item>
|
---|
| 549 | </xsl:if>
|
---|
| 550 | <xsl:if test="$refs[not(@significance) or @significance!='preferred'][not(see)]">
|
---|
| 551 | <rx:index-item xsl:use-attribute-sets="xep.index.item.properties">
|
---|
| 552 | <xsl:attribute name="ref-key">
|
---|
| 553 | <xsl:value-of select="$primary"/>
|
---|
| 554 | <xsl:text>, </xsl:text>
|
---|
| 555 | <xsl:value-of select="$secondary"/>
|
---|
| 556 | <xsl:text>, </xsl:text>
|
---|
| 557 | <xsl:value-of select="$tertiary"/>
|
---|
| 558 | </xsl:attribute>
|
---|
| 559 | </rx:index-item>
|
---|
| 560 | </xsl:if>
|
---|
| 561 | </rx:page-index>
|
---|
| 562 | </xsl:if>
|
---|
| 563 | </xsl:when>
|
---|
| 564 | <xsl:otherwise>
|
---|
| 565 | <xsl:variable name="page-number-citations">
|
---|
| 566 | <xsl:for-each select="$refs[not(see)]">
|
---|
| 567 | <xsl:apply-templates select="." mode="reference">
|
---|
| 568 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 569 | <xsl:with-param name="role" select="$role"/>
|
---|
| 570 | <xsl:with-param name="type" select="$type"/>
|
---|
| 571 | <xsl:with-param name="position" select="position()"/>
|
---|
| 572 | </xsl:apply-templates>
|
---|
| 573 | </xsl:for-each>
|
---|
| 574 | </xsl:variable>
|
---|
| 575 |
|
---|
[15c7d39] | 576 | <xsl:copy-of select="$page-number-citations"/>
|
---|
[c873d807] | 577 | </xsl:otherwise>
|
---|
| 578 | </xsl:choose>
|
---|
| 579 |
|
---|
| 580 | <xsl:if test="$refs/see">
|
---|
| 581 | <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, see))[&scope;][1])]"
|
---|
| 582 | mode="index-see">
|
---|
| 583 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 584 | <xsl:with-param name="role" select="$role"/>
|
---|
| 585 | <xsl:with-param name="type" select="$type"/>
|
---|
| 586 | <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
|
---|
| 587 | </xsl:apply-templates>
|
---|
| 588 | </xsl:if>
|
---|
| 589 |
|
---|
| 590 | </fo:block>
|
---|
| 591 |
|
---|
| 592 | <xsl:if test="$refs/seealso">
|
---|
| 593 | <fo:block>
|
---|
| 594 | <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, seealso))[&scope;][1])]"
|
---|
| 595 | mode="index-seealso">
|
---|
| 596 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 597 | <xsl:with-param name="role" select="$role"/>
|
---|
| 598 | <xsl:with-param name="type" select="$type"/>
|
---|
| 599 | <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
|
---|
| 600 | </xsl:apply-templates>
|
---|
| 601 | </fo:block>
|
---|
| 602 | </xsl:if>
|
---|
| 603 | </xsl:template>
|
---|
| 604 |
|
---|
| 605 | <xsl:template match="indexterm" mode="reference">
|
---|
| 606 | <xsl:param name="scope" select="."/>
|
---|
| 607 | <xsl:param name="role" select="''"/>
|
---|
| 608 | <xsl:param name="type" select="''"/>
|
---|
| 609 | <xsl:param name="position" select="0"/>
|
---|
| 610 | <xsl:param name="separator" select="''"/>
|
---|
| 611 |
|
---|
| 612 | <xsl:variable name="term.separator">
|
---|
| 613 | <xsl:call-template name="index.separator">
|
---|
| 614 | <xsl:with-param name="key" select="'index.term.separator'"/>
|
---|
| 615 | </xsl:call-template>
|
---|
| 616 | </xsl:variable>
|
---|
| 617 |
|
---|
| 618 | <xsl:variable name="range.separator">
|
---|
| 619 | <xsl:call-template name="index.separator">
|
---|
| 620 | <xsl:with-param name="key" select="'index.range.separator'"/>
|
---|
| 621 | </xsl:call-template>
|
---|
| 622 | </xsl:variable>
|
---|
| 623 |
|
---|
| 624 | <xsl:variable name="number.separator">
|
---|
| 625 | <xsl:call-template name="index.separator">
|
---|
| 626 | <xsl:with-param name="key" select="'index.number.separator'"/>
|
---|
| 627 | </xsl:call-template>
|
---|
| 628 | </xsl:variable>
|
---|
| 629 |
|
---|
| 630 | <xsl:choose>
|
---|
| 631 | <xsl:when test="$separator != ''">
|
---|
| 632 | <xsl:value-of select="$separator"/>
|
---|
| 633 | </xsl:when>
|
---|
| 634 | <xsl:when test="$position = 1">
|
---|
| 635 | <xsl:value-of select="$term.separator"/>
|
---|
| 636 | </xsl:when>
|
---|
| 637 | <xsl:otherwise>
|
---|
| 638 | <xsl:value-of select="$number.separator"/>
|
---|
| 639 | </xsl:otherwise>
|
---|
| 640 | </xsl:choose>
|
---|
| 641 |
|
---|
| 642 | <xsl:choose>
|
---|
| 643 | <xsl:when test="@zone and string(@zone)">
|
---|
| 644 | <xsl:call-template name="reference">
|
---|
| 645 | <xsl:with-param name="zones" select="normalize-space(@zone)"/>
|
---|
| 646 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 647 | <xsl:with-param name="role" select="$role"/>
|
---|
| 648 | <xsl:with-param name="type" select="$type"/>
|
---|
| 649 | </xsl:call-template>
|
---|
| 650 | </xsl:when>
|
---|
| 651 | <xsl:when test="ancestor::*[contains(local-name(),'info') and not(starts-with(local-name(),'info'))]">
|
---|
| 652 | <xsl:call-template name="info.reference">
|
---|
| 653 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 654 | <xsl:with-param name="role" select="$role"/>
|
---|
| 655 | <xsl:with-param name="type" select="$type"/>
|
---|
| 656 | </xsl:call-template>
|
---|
| 657 | </xsl:when>
|
---|
| 658 | <xsl:otherwise>
|
---|
| 659 | <xsl:variable name="id">
|
---|
| 660 | <xsl:call-template name="object.id"/>
|
---|
| 661 | </xsl:variable>
|
---|
| 662 |
|
---|
| 663 | <fo:basic-link internal-destination="{$id}"
|
---|
| 664 | xsl:use-attribute-sets="index.page.number.properties">
|
---|
| 665 | <fo:page-number-citation ref-id="{$id}"/>
|
---|
| 666 | </fo:basic-link>
|
---|
| 667 |
|
---|
| 668 | <xsl:if test="key('endofrange', $id)[&scope;]">
|
---|
| 669 | <xsl:apply-templates select="key('endofrange', $id)[&scope;][last()]"
|
---|
| 670 | mode="reference">
|
---|
| 671 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 672 | <xsl:with-param name="role" select="$role"/>
|
---|
| 673 | <xsl:with-param name="type" select="$type"/>
|
---|
| 674 | <xsl:with-param name="separator" select="$range.separator"/>
|
---|
| 675 | </xsl:apply-templates>
|
---|
| 676 | </xsl:if>
|
---|
| 677 | </xsl:otherwise>
|
---|
| 678 | </xsl:choose>
|
---|
| 679 | </xsl:template>
|
---|
| 680 |
|
---|
| 681 | <xsl:template name="reference">
|
---|
| 682 | <xsl:param name="scope" select="."/>
|
---|
| 683 | <xsl:param name="role" select="''"/>
|
---|
| 684 | <xsl:param name="type" select="''"/>
|
---|
| 685 | <xsl:param name="zones"/>
|
---|
| 686 |
|
---|
| 687 | <xsl:variable name="number.separator">
|
---|
| 688 | <xsl:call-template name="index.separator">
|
---|
| 689 | <xsl:with-param name="key" select="'index.number.separator'"/>
|
---|
| 690 | </xsl:call-template>
|
---|
| 691 | </xsl:variable>
|
---|
| 692 |
|
---|
| 693 | <xsl:choose>
|
---|
| 694 | <xsl:when test="contains($zones, ' ')">
|
---|
| 695 | <xsl:variable name="zone" select="substring-before($zones, ' ')"/>
|
---|
[15c7d39] | 696 | <xsl:variable name="target" select="key('id', $zone)"/>
|
---|
[c873d807] | 697 |
|
---|
| 698 | <xsl:variable name="id">
|
---|
| 699 | <xsl:call-template name="object.id">
|
---|
| 700 | <xsl:with-param name="object" select="$target[1]"/>
|
---|
| 701 | </xsl:call-template>
|
---|
| 702 | </xsl:variable>
|
---|
| 703 |
|
---|
| 704 | <fo:basic-link internal-destination="{$id}"
|
---|
| 705 | xsl:use-attribute-sets="index.page.number.properties">
|
---|
| 706 | <fo:page-number-citation ref-id="{$id}"/>
|
---|
| 707 | </fo:basic-link>
|
---|
| 708 |
|
---|
[15c7d39] | 709 | <xsl:copy-of select="$number.separator"/>
|
---|
[c873d807] | 710 | <xsl:call-template name="reference">
|
---|
| 711 | <xsl:with-param name="zones" select="substring-after($zones, ' ')"/>
|
---|
| 712 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 713 | <xsl:with-param name="role" select="$role"/>
|
---|
| 714 | <xsl:with-param name="type" select="$type"/>
|
---|
| 715 | </xsl:call-template>
|
---|
| 716 | </xsl:when>
|
---|
| 717 | <xsl:otherwise>
|
---|
| 718 | <xsl:variable name="zone" select="$zones"/>
|
---|
[15c7d39] | 719 | <xsl:variable name="target" select="key('id', $zone)"/>
|
---|
[c873d807] | 720 |
|
---|
| 721 | <xsl:variable name="id">
|
---|
| 722 | <xsl:call-template name="object.id">
|
---|
| 723 | <xsl:with-param name="object" select="$target[1]"/>
|
---|
| 724 | </xsl:call-template>
|
---|
| 725 | </xsl:variable>
|
---|
| 726 |
|
---|
| 727 | <fo:basic-link internal-destination="{$id}"
|
---|
| 728 | xsl:use-attribute-sets="index.page.number.properties">
|
---|
| 729 | <fo:page-number-citation ref-id="{$id}"/>
|
---|
| 730 | </fo:basic-link>
|
---|
| 731 | </xsl:otherwise>
|
---|
| 732 | </xsl:choose>
|
---|
| 733 | </xsl:template>
|
---|
| 734 |
|
---|
| 735 | <xsl:template name="info.reference">
|
---|
| 736 | <!-- This is not perfect. It doesn't treat indexterm inside info element as a range covering whole parent of info.
|
---|
| 737 | It also not work when there is no ID generated for parent element. But it works in the most common cases. -->
|
---|
| 738 | <xsl:param name="scope" select="."/>
|
---|
| 739 | <xsl:param name="role" select="''"/>
|
---|
| 740 | <xsl:param name="type" select="''"/>
|
---|
| 741 |
|
---|
| 742 | <xsl:variable name="target" select="(ancestor::appendix|ancestor::article|ancestor::bibliography|ancestor::book|
|
---|
| 743 | ancestor::chapter|ancestor::glossary|ancestor::part|ancestor::preface|
|
---|
| 744 | ancestor::refentry|ancestor::reference|ancestor::refsect1|ancestor::refsect2|
|
---|
| 745 | ancestor::refsect3|ancestor::refsection|ancestor::refsynopsisdiv|
|
---|
| 746 | ancestor::sect1|ancestor::sect2|ancestor::sect3|ancestor::sect4|ancestor::sect5|
|
---|
[15c7d39] | 747 | ancestor::section|ancestor::setindex|ancestor::set|ancestor::sidebar|ancestor::mediaobject)[&scope;]"/>
|
---|
[c873d807] | 748 |
|
---|
| 749 | <xsl:variable name="id">
|
---|
| 750 | <xsl:call-template name="object.id">
|
---|
[15c7d39] | 751 | <xsl:with-param name="object" select="$target[position() = last()]"/>
|
---|
[c873d807] | 752 | </xsl:call-template>
|
---|
| 753 | </xsl:variable>
|
---|
| 754 |
|
---|
| 755 | <fo:basic-link internal-destination="{$id}"
|
---|
| 756 | xsl:use-attribute-sets="index.page.number.properties">
|
---|
| 757 | <fo:page-number-citation ref-id="{$id}"/>
|
---|
| 758 | </fo:basic-link>
|
---|
| 759 | </xsl:template>
|
---|
| 760 |
|
---|
| 761 | <xsl:template match="indexterm" mode="index-see">
|
---|
| 762 | <xsl:param name="scope" select="."/>
|
---|
| 763 | <xsl:param name="role" select="''"/>
|
---|
| 764 | <xsl:param name="type" select="''"/>
|
---|
| 765 |
|
---|
| 766 | <fo:inline>
|
---|
| 767 | <xsl:text> (</xsl:text>
|
---|
| 768 | <xsl:call-template name="gentext">
|
---|
| 769 | <xsl:with-param name="key" select="'see'"/>
|
---|
| 770 | </xsl:call-template>
|
---|
| 771 | <xsl:text> </xsl:text>
|
---|
| 772 | <xsl:value-of select="see"/>
|
---|
| 773 | <xsl:text>)</xsl:text>
|
---|
| 774 | </fo:inline>
|
---|
| 775 | </xsl:template>
|
---|
| 776 |
|
---|
| 777 | <xsl:template match="indexterm" mode="index-seealso">
|
---|
| 778 | <xsl:param name="scope" select="."/>
|
---|
| 779 | <xsl:param name="role" select="''"/>
|
---|
| 780 | <xsl:param name="type" select="''"/>
|
---|
| 781 |
|
---|
| 782 | <xsl:for-each select="seealso">
|
---|
| 783 | <xsl:sort select="translate(., &lowercase;, &uppercase;)"/>
|
---|
| 784 | <fo:block>
|
---|
| 785 | <xsl:text>(</xsl:text>
|
---|
| 786 | <xsl:call-template name="gentext">
|
---|
| 787 | <xsl:with-param name="key" select="'seealso'"/>
|
---|
| 788 | </xsl:call-template>
|
---|
| 789 | <xsl:text> </xsl:text>
|
---|
| 790 | <xsl:value-of select="."/>
|
---|
| 791 | <xsl:text>)</xsl:text>
|
---|
| 792 | </fo:block>
|
---|
| 793 | </xsl:for-each>
|
---|
| 794 |
|
---|
| 795 | </xsl:template>
|
---|
| 796 |
|
---|
| 797 | <!-- ====================================================================== -->
|
---|
| 798 |
|
---|
| 799 | <xsl:template name="generate-index-markup">
|
---|
| 800 | <xsl:param name="scope" select="(ancestor::book|/)[last()]"/>
|
---|
| 801 | <xsl:param name="role" select="@role"/>
|
---|
| 802 | <xsl:param name="type" select="@type"/>
|
---|
| 803 |
|
---|
| 804 | <xsl:variable name="terms" select="$scope//indexterm[count(.|key('letter',
|
---|
| 805 | translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;))[&scope;][1]) = 1]"/>
|
---|
| 806 | <xsl:variable name="alphabetical"
|
---|
| 807 | select="$terms[contains(concat(&lowercase;, &uppercase;),
|
---|
| 808 | substring(&primary;, 1, 1))]"/>
|
---|
| 809 | <xsl:variable name="others" select="$terms[not(contains(concat(&lowercase;,
|
---|
| 810 | &uppercase;),
|
---|
| 811 | substring(&primary;, 1, 1)))]"/>
|
---|
| 812 |
|
---|
| 813 | <xsl:text><index> </xsl:text>
|
---|
| 814 | <xsl:if test="$others">
|
---|
| 815 | <xsl:text> <indexdiv> </xsl:text>
|
---|
| 816 | <xsl:text><title></xsl:text>
|
---|
| 817 | <xsl:call-template name="gentext">
|
---|
| 818 | <xsl:with-param name="key" select="'index symbols'"/>
|
---|
| 819 | </xsl:call-template>
|
---|
| 820 | <xsl:text></title> </xsl:text>
|
---|
| 821 | <xsl:apply-templates select="$others[count(.|key('primary',
|
---|
| 822 | &primary;)[&scope;][1]) = 1]"
|
---|
| 823 | mode="index-symbol-div-markup">
|
---|
| 824 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 825 | <xsl:with-param name="role" select="$role"/>
|
---|
| 826 | <xsl:with-param name="type" select="$type"/>
|
---|
| 827 | <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
---|
| 828 | </xsl:apply-templates>
|
---|
| 829 | <xsl:text></indexdiv> </xsl:text>
|
---|
| 830 | </xsl:if>
|
---|
| 831 |
|
---|
| 832 | <xsl:apply-templates select="$alphabetical[count(.|key('letter',
|
---|
| 833 | translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;))[&scope;][1]) = 1]"
|
---|
| 834 | mode="index-div-markup">
|
---|
| 835 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 836 | <xsl:with-param name="role" select="$role"/>
|
---|
| 837 | <xsl:with-param name="type" select="$type"/>
|
---|
| 838 | <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
---|
| 839 | </xsl:apply-templates>
|
---|
| 840 | <xsl:text></index> </xsl:text>
|
---|
| 841 | </xsl:template>
|
---|
| 842 |
|
---|
| 843 | <xsl:template match="*" mode="index-markup">
|
---|
| 844 | <xsl:param name="scope" select="."/>
|
---|
| 845 | <xsl:param name="role" select="''"/>
|
---|
| 846 | <xsl:param name="type" select="''"/>
|
---|
| 847 |
|
---|
| 848 | <xsl:text><</xsl:text>
|
---|
| 849 | <xsl:value-of select="local-name(.)"/>
|
---|
| 850 | <xsl:text>> </xsl:text>
|
---|
| 851 | <xsl:apply-templates mode="index-markup">
|
---|
| 852 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 853 | <xsl:with-param name="role" select="$role"/>
|
---|
| 854 | <xsl:with-param name="type" select="$type"/>
|
---|
| 855 | </xsl:apply-templates>
|
---|
| 856 | </xsl:template>
|
---|
| 857 |
|
---|
| 858 | <xsl:template match="indexterm" mode="index-div-markup">
|
---|
| 859 | <xsl:param name="scope" select="."/>
|
---|
| 860 | <xsl:param name="role" select="''"/>
|
---|
| 861 | <xsl:param name="type" select="''"/>
|
---|
| 862 | <xsl:variable name="key" select="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
|
---|
| 863 | <xsl:text> <indexdiv> </xsl:text>
|
---|
| 864 | <xsl:text><title></xsl:text>
|
---|
| 865 | <xsl:value-of select="translate($key, &lowercase;, &uppercase;)"/>
|
---|
| 866 | <xsl:text></title> </xsl:text>
|
---|
| 867 |
|
---|
| 868 | <xsl:apply-templates select="key('letter', $key)[&scope;][count(.|key('primary', &primary;)[&scope;][1]) = 1]"
|
---|
| 869 | mode="index-primary-markup">
|
---|
| 870 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 871 | <xsl:with-param name="role" select="$role"/>
|
---|
| 872 | <xsl:with-param name="type" select="$type"/>
|
---|
| 873 | <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
---|
| 874 | </xsl:apply-templates>
|
---|
| 875 | <xsl:text></indexdiv> </xsl:text>
|
---|
| 876 | </xsl:template>
|
---|
| 877 |
|
---|
| 878 | <xsl:template match="indexterm" mode="index-symbol-div-markup">
|
---|
| 879 | <xsl:param name="scope" select="."/>
|
---|
| 880 | <xsl:param name="role" select="''"/>
|
---|
| 881 | <xsl:param name="type" select="''"/>
|
---|
| 882 | <xsl:variable name="key" select="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
|
---|
| 883 |
|
---|
| 884 | <xsl:apply-templates select="key('letter', $key)[&scope;][count(.|key('primary', &primary;)[&scope;][1]) = 1]"
|
---|
| 885 | mode="index-primary-markup">
|
---|
| 886 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 887 | <xsl:with-param name="role" select="$role"/>
|
---|
| 888 | <xsl:with-param name="type" select="$type"/>
|
---|
| 889 | <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
---|
| 890 | </xsl:apply-templates>
|
---|
| 891 | </xsl:template>
|
---|
| 892 |
|
---|
| 893 | <xsl:template match="indexterm" mode="index-primary-markup">
|
---|
| 894 | <xsl:param name="scope" select="."/>
|
---|
| 895 | <xsl:param name="role" select="''"/>
|
---|
| 896 | <xsl:param name="type" select="''"/>
|
---|
| 897 | <xsl:variable name="key" select="&primary;"/>
|
---|
| 898 | <xsl:variable name="refs" select="key('primary', $key)[&scope;]"/>
|
---|
| 899 | <xsl:variable name="pages" select="$refs[not(see) and not(seealso)]"/>
|
---|
| 900 |
|
---|
| 901 | <xsl:text> <indexentry> </xsl:text>
|
---|
| 902 | <xsl:text><primaryie></xsl:text>
|
---|
| 903 | <xsl:text><phrase></xsl:text>
|
---|
| 904 | <xsl:call-template name="escape-text">
|
---|
| 905 | <xsl:with-param name="text" select="string(primary)"/>
|
---|
| 906 | </xsl:call-template>
|
---|
| 907 | <xsl:text></phrase></xsl:text>
|
---|
| 908 | <xsl:if test="$pages">,</xsl:if>
|
---|
| 909 | <xsl:text> </xsl:text>
|
---|
| 910 |
|
---|
| 911 | <xsl:for-each select="$pages">
|
---|
| 912 | <xsl:apply-templates select="." mode="reference-markup">
|
---|
| 913 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 914 | <xsl:with-param name="role" select="$role"/>
|
---|
| 915 | <xsl:with-param name="type" select="$type"/>
|
---|
| 916 | </xsl:apply-templates>
|
---|
| 917 | </xsl:for-each>
|
---|
| 918 |
|
---|
| 919 | <xsl:text></primaryie> </xsl:text>
|
---|
| 920 |
|
---|
| 921 | <xsl:if test="$refs/secondary or $refs[not(secondary)]/*[self::see or self::seealso]">
|
---|
| 922 | <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &sep;, &sep;, see))[&scope;][1])]"
|
---|
| 923 | mode="index-see-markup">
|
---|
| 924 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 925 | <xsl:with-param name="role" select="$role"/>
|
---|
| 926 | <xsl:with-param name="type" select="$type"/>
|
---|
| 927 | <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
|
---|
| 928 | </xsl:apply-templates>
|
---|
| 929 |
|
---|
| 930 | <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &sep;, &sep;, seealso))[&scope;][1])]"
|
---|
| 931 | mode="index-seealso-markup">
|
---|
| 932 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 933 | <xsl:with-param name="role" select="$role"/>
|
---|
| 934 | <xsl:with-param name="type" select="$type"/>
|
---|
| 935 | <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
|
---|
| 936 | </xsl:apply-templates>
|
---|
| 937 |
|
---|
| 938 | <xsl:apply-templates select="$refs[secondary and count(.|key('secondary', concat($key, &sep;, &secondary;))[&scope;][1]) = 1]"
|
---|
| 939 | mode="index-secondary-markup">
|
---|
| 940 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 941 | <xsl:with-param name="role" select="$role"/>
|
---|
| 942 | <xsl:with-param name="type" select="$type"/>
|
---|
| 943 | <xsl:sort select="translate(&secondary;, &lowercase;, &uppercase;)"/>
|
---|
| 944 | </xsl:apply-templates>
|
---|
| 945 | </xsl:if>
|
---|
| 946 | <xsl:text></indexentry> </xsl:text>
|
---|
| 947 | </xsl:template>
|
---|
| 948 |
|
---|
| 949 | <xsl:template match="indexterm" mode="index-secondary-markup">
|
---|
| 950 | <xsl:param name="scope" select="."/>
|
---|
| 951 | <xsl:param name="role" select="''"/>
|
---|
| 952 | <xsl:param name="type" select="''"/>
|
---|
| 953 | <xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;)"/>
|
---|
| 954 | <xsl:variable name="refs" select="key('secondary', $key)[&scope;]"/>
|
---|
| 955 | <xsl:variable name="pages" select="$refs[not(see) and not(seealso)]"/>
|
---|
| 956 |
|
---|
| 957 | <xsl:text><secondaryie></xsl:text>
|
---|
| 958 | <xsl:text><phrase></xsl:text>
|
---|
| 959 | <xsl:call-template name="escape-text">
|
---|
| 960 | <xsl:with-param name="text" select="string(secondary)"/>
|
---|
| 961 | </xsl:call-template>
|
---|
| 962 | <xsl:text></phrase></xsl:text>
|
---|
| 963 | <xsl:if test="$pages">,</xsl:if>
|
---|
| 964 | <xsl:text> </xsl:text>
|
---|
| 965 |
|
---|
| 966 | <xsl:for-each select="$pages">
|
---|
| 967 | <xsl:apply-templates select="." mode="reference-markup">
|
---|
| 968 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 969 | <xsl:with-param name="role" select="$role"/>
|
---|
| 970 | <xsl:with-param name="type" select="$type"/>
|
---|
| 971 | </xsl:apply-templates>
|
---|
| 972 | </xsl:for-each>
|
---|
| 973 |
|
---|
| 974 | <xsl:text></secondaryie> </xsl:text>
|
---|
| 975 |
|
---|
| 976 | <xsl:if test="$refs/tertiary or $refs[not(tertiary)]/*[self::see or self::seealso]">
|
---|
| 977 | <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &secondary;, &sep;, &sep;, see))[&scope;][1])]"
|
---|
| 978 | mode="index-see-markup">
|
---|
| 979 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 980 | <xsl:with-param name="role" select="$role"/>
|
---|
| 981 | <xsl:with-param name="type" select="$type"/>
|
---|
| 982 | <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
|
---|
| 983 | </xsl:apply-templates>
|
---|
| 984 | <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &secondary;, &sep;, &sep;, seealso))[&scope;][1])]"
|
---|
| 985 | mode="index-seealso-markup">
|
---|
| 986 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 987 | <xsl:with-param name="role" select="$role"/>
|
---|
| 988 | <xsl:with-param name="type" select="$type"/>
|
---|
| 989 | <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
|
---|
| 990 | </xsl:apply-templates>
|
---|
| 991 | <xsl:apply-templates select="$refs[tertiary and count(.|key('tertiary', concat($key, &sep;, &tertiary;))[&scope;][1]) = 1]"
|
---|
| 992 | mode="index-tertiary-markup">
|
---|
| 993 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 994 | <xsl:with-param name="role" select="$role"/>
|
---|
| 995 | <xsl:with-param name="type" select="$type"/>
|
---|
| 996 | <xsl:sort select="translate(&tertiary;, &lowercase;, &uppercase;)"/>
|
---|
| 997 | </xsl:apply-templates>
|
---|
| 998 | </xsl:if>
|
---|
| 999 | </xsl:template>
|
---|
| 1000 |
|
---|
| 1001 | <xsl:template match="indexterm" mode="index-tertiary-markup">
|
---|
| 1002 | <xsl:param name="scope" select="."/>
|
---|
| 1003 | <xsl:param name="role" select="''"/>
|
---|
| 1004 | <xsl:param name="type" select="''"/>
|
---|
| 1005 | <xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;)"/>
|
---|
| 1006 | <xsl:variable name="refs" select="key('tertiary', $key)[&scope;]"/>
|
---|
| 1007 | <xsl:variable name="pages" select="$refs[not(see) and not(seealso)]"/>
|
---|
| 1008 |
|
---|
| 1009 | <xsl:text><tertiaryie></xsl:text>
|
---|
| 1010 | <xsl:text><phrase></xsl:text>
|
---|
| 1011 | <xsl:call-template name="escape-text">
|
---|
| 1012 | <xsl:with-param name="text" select="string(tertiary)"/>
|
---|
| 1013 | </xsl:call-template>
|
---|
| 1014 | <xsl:text></phrase></xsl:text>
|
---|
| 1015 | <xsl:if test="$pages">,</xsl:if>
|
---|
| 1016 | <xsl:text> </xsl:text>
|
---|
| 1017 |
|
---|
| 1018 | <xsl:for-each select="$pages">
|
---|
| 1019 | <xsl:apply-templates select="." mode="reference-markup">
|
---|
| 1020 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 1021 | <xsl:with-param name="role" select="$role"/>
|
---|
| 1022 | <xsl:with-param name="type" select="$type"/>
|
---|
| 1023 | </xsl:apply-templates>
|
---|
| 1024 | </xsl:for-each>
|
---|
| 1025 |
|
---|
| 1026 | <xsl:text></tertiaryie> </xsl:text>
|
---|
| 1027 |
|
---|
| 1028 | <xsl:variable name="see" select="$refs/see | $refs/seealso"/>
|
---|
| 1029 | <xsl:if test="$see">
|
---|
| 1030 | <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, see))[&scope;][1])]"
|
---|
| 1031 | mode="index-see-markup">
|
---|
| 1032 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 1033 | <xsl:with-param name="role" select="$role"/>
|
---|
| 1034 | <xsl:with-param name="type" select="$type"/>
|
---|
| 1035 | <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
|
---|
| 1036 | </xsl:apply-templates>
|
---|
| 1037 | <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, seealso))[&scope;][1])]"
|
---|
| 1038 | mode="index-seealso-markup">
|
---|
| 1039 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 1040 | <xsl:with-param name="role" select="$role"/>
|
---|
| 1041 | <xsl:with-param name="type" select="$type"/>
|
---|
| 1042 | <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
|
---|
| 1043 | </xsl:apply-templates>
|
---|
| 1044 | </xsl:if>
|
---|
| 1045 | </xsl:template>
|
---|
| 1046 |
|
---|
| 1047 | <xsl:template match="indexterm" mode="reference-markup">
|
---|
| 1048 | <xsl:param name="scope" select="."/>
|
---|
| 1049 | <xsl:param name="role" select="''"/>
|
---|
| 1050 | <xsl:param name="type" select="''"/>
|
---|
| 1051 |
|
---|
| 1052 | <xsl:choose>
|
---|
| 1053 | <xsl:when test="@zone and string(@zone)">
|
---|
| 1054 | <xsl:call-template name="reference-markup">
|
---|
| 1055 | <xsl:with-param name="zones" select="normalize-space(@zone)"/>
|
---|
| 1056 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 1057 | <xsl:with-param name="role" select="$role"/>
|
---|
| 1058 | <xsl:with-param name="type" select="$type"/>
|
---|
| 1059 | </xsl:call-template>
|
---|
| 1060 | </xsl:when>
|
---|
| 1061 | <xsl:otherwise>
|
---|
| 1062 | <xsl:variable name="id">
|
---|
| 1063 | <xsl:call-template name="object.id"/>
|
---|
| 1064 | </xsl:variable>
|
---|
| 1065 |
|
---|
| 1066 |
|
---|
| 1067 | <xsl:choose>
|
---|
| 1068 | <xsl:when test="@startref and @class='endofrange'">
|
---|
| 1069 | <xsl:text><phrase role="pageno"></xsl:text>
|
---|
| 1070 | <xsl:text><link linkend="</xsl:text>
|
---|
| 1071 | <xsl:value-of select="@startref"/>
|
---|
| 1072 | <xsl:text>"></xsl:text>
|
---|
| 1073 | <fo:basic-link internal-destination="{@startref}"
|
---|
| 1074 | xsl:use-attribute-sets="index.page.number.properties">
|
---|
| 1075 | <fo:page-number-citation ref-id="{@startref}"/>
|
---|
| 1076 | <xsl:text>-</xsl:text>
|
---|
| 1077 | <fo:page-number-citation ref-id="{$id}"/>
|
---|
| 1078 | </fo:basic-link>
|
---|
| 1079 | <xsl:text></link></xsl:text>
|
---|
| 1080 | <xsl:text></phrase> </xsl:text>
|
---|
| 1081 | </xsl:when>
|
---|
| 1082 | <xsl:otherwise>
|
---|
| 1083 | <xsl:text><phrase role="pageno"></xsl:text>
|
---|
| 1084 | <xsl:if test="$id">
|
---|
| 1085 | <xsl:text><link linkend="</xsl:text>
|
---|
| 1086 | <xsl:value-of select="$id"/>
|
---|
| 1087 | <xsl:text>"></xsl:text>
|
---|
| 1088 | </xsl:if>
|
---|
| 1089 | <fo:basic-link internal-destination="{$id}"
|
---|
| 1090 | xsl:use-attribute-sets="index.page.number.properties">
|
---|
| 1091 | <fo:page-number-citation ref-id="{$id}"/>
|
---|
| 1092 | </fo:basic-link>
|
---|
| 1093 | <xsl:if test="$id">
|
---|
| 1094 | <xsl:text></link></xsl:text>
|
---|
| 1095 | </xsl:if>
|
---|
| 1096 | <xsl:text></phrase> </xsl:text>
|
---|
| 1097 | </xsl:otherwise>
|
---|
| 1098 | </xsl:choose>
|
---|
| 1099 | </xsl:otherwise>
|
---|
| 1100 | </xsl:choose>
|
---|
| 1101 | </xsl:template>
|
---|
| 1102 |
|
---|
| 1103 | <xsl:template name="reference-markup">
|
---|
| 1104 | <xsl:param name="scope" select="."/>
|
---|
| 1105 | <xsl:param name="role" select="''"/>
|
---|
| 1106 | <xsl:param name="type" select="''"/>
|
---|
| 1107 | <xsl:param name="zones"/>
|
---|
| 1108 | <xsl:choose>
|
---|
| 1109 | <xsl:when test="contains($zones, ' ')">
|
---|
| 1110 | <xsl:variable name="zone" select="substring-before($zones, ' ')"/>
|
---|
| 1111 | <xsl:variable name="target" select="key('id', $zone)[&scope;]"/>
|
---|
| 1112 |
|
---|
| 1113 | <xsl:variable name="id">
|
---|
| 1114 | <xsl:call-template name="object.id">
|
---|
| 1115 | <xsl:with-param name="object" select="$target[1]"/>
|
---|
| 1116 | </xsl:call-template>
|
---|
| 1117 | </xsl:variable>
|
---|
| 1118 |
|
---|
[15c7d39] | 1119 | <xsl:text><phrase role="pageno"></xsl:text>
|
---|
[c873d807] | 1120 | <xsl:if test="$target[1]/@id or $target[1]/@xml:id">
|
---|
| 1121 | <xsl:text><link linkend="</xsl:text>
|
---|
| 1122 | <xsl:value-of select="$id"/>
|
---|
| 1123 | <xsl:text>"></xsl:text>
|
---|
| 1124 | </xsl:if>
|
---|
| 1125 | <fo:basic-link internal-destination="{$id}"
|
---|
| 1126 | xsl:use-attribute-sets="index.page.number.properties">
|
---|
| 1127 | <fo:page-number-citation ref-id="{$id}"/>
|
---|
| 1128 | </fo:basic-link>
|
---|
| 1129 | <xsl:if test="$target[1]/@id or $target[1]/@xml:id">
|
---|
| 1130 | <xsl:text></link></xsl:text>
|
---|
| 1131 | </xsl:if>
|
---|
| 1132 | <xsl:text></phrase> </xsl:text>
|
---|
| 1133 |
|
---|
| 1134 | <xsl:call-template name="reference">
|
---|
| 1135 | <xsl:with-param name="zones" select="substring-after($zones, ' ')"/>
|
---|
| 1136 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 1137 | <xsl:with-param name="role" select="$role"/>
|
---|
| 1138 | <xsl:with-param name="type" select="$type"/>
|
---|
| 1139 | </xsl:call-template>
|
---|
| 1140 | </xsl:when>
|
---|
| 1141 | <xsl:otherwise>
|
---|
| 1142 | <xsl:variable name="zone" select="$zones"/>
|
---|
| 1143 | <xsl:variable name="target" select="key('id', $zone)[&scope;]"/>
|
---|
| 1144 |
|
---|
| 1145 | <xsl:variable name="id">
|
---|
| 1146 | <xsl:call-template name="object.id">
|
---|
| 1147 | <xsl:with-param name="object" select="$target[1]"/>
|
---|
| 1148 | </xsl:call-template>
|
---|
| 1149 | </xsl:variable>
|
---|
| 1150 |
|
---|
| 1151 | <xsl:text><phrase role="pageno"></xsl:text>
|
---|
| 1152 | <xsl:if test="$target[1]/@id or target[1]/@xml:id">
|
---|
| 1153 | <xsl:text><link linkend="</xsl:text>
|
---|
| 1154 | <xsl:value-of select="$id"/>
|
---|
| 1155 | <xsl:text>"></xsl:text>
|
---|
| 1156 | </xsl:if>
|
---|
| 1157 | <fo:basic-link internal-destination="{$id}"
|
---|
| 1158 | xsl:use-attribute-sets="index.page.number.properties">
|
---|
| 1159 | <fo:page-number-citation ref-id="{$id}"/>
|
---|
| 1160 | </fo:basic-link>
|
---|
| 1161 | <xsl:if test="$target[1]/@id or target[1]/@xml:id">
|
---|
| 1162 | <xsl:text></link></xsl:text>
|
---|
| 1163 | </xsl:if>
|
---|
| 1164 | <xsl:text></phrase> </xsl:text>
|
---|
| 1165 | </xsl:otherwise>
|
---|
| 1166 | </xsl:choose>
|
---|
| 1167 | </xsl:template>
|
---|
| 1168 |
|
---|
| 1169 | <xsl:template match="indexterm" mode="index-see-markup">
|
---|
| 1170 | <xsl:param name="scope" select="."/>
|
---|
| 1171 | <xsl:param name="role" select="''"/>
|
---|
| 1172 | <xsl:param name="type" select="''"/>
|
---|
| 1173 | <fo:block>
|
---|
| 1174 | <xsl:text><seeie></xsl:text>
|
---|
| 1175 | <xsl:text><phrase></xsl:text>
|
---|
| 1176 | <xsl:call-template name="escape-text">
|
---|
| 1177 | <xsl:with-param name="text" select="string(see)"/>
|
---|
| 1178 | </xsl:call-template>
|
---|
| 1179 | <xsl:text></phrase></xsl:text>
|
---|
| 1180 | <xsl:text></seeie> </xsl:text>
|
---|
| 1181 | </fo:block>
|
---|
| 1182 | </xsl:template>
|
---|
| 1183 |
|
---|
| 1184 | <xsl:template match="indexterm" mode="index-seealso-markup">
|
---|
| 1185 | <xsl:param name="scope" select="."/>
|
---|
| 1186 | <xsl:param name="role" select="''"/>
|
---|
| 1187 | <xsl:param name="type" select="''"/>
|
---|
| 1188 | <fo:block>
|
---|
| 1189 | <xsl:text><seealsoie></xsl:text>
|
---|
| 1190 | <xsl:text><phrase></xsl:text>
|
---|
| 1191 | <xsl:call-template name="escape-text">
|
---|
| 1192 | <xsl:with-param name="text" select="string(seealso)"/>
|
---|
| 1193 | </xsl:call-template>
|
---|
| 1194 | <xsl:text></phrase></xsl:text>
|
---|
| 1195 | <xsl:text></seealsoie> </xsl:text>
|
---|
| 1196 | </fo:block>
|
---|
| 1197 | </xsl:template>
|
---|
| 1198 |
|
---|
| 1199 | <xsl:template name="escape-text">
|
---|
| 1200 | <xsl:param name="text" select="''"/>
|
---|
| 1201 |
|
---|
| 1202 | <xsl:variable name="ltpos" select="substring-before($text, '<')"/>
|
---|
| 1203 | <xsl:variable name="amppos" select="substring-before($text, '&')"/>
|
---|
| 1204 |
|
---|
| 1205 | <xsl:choose>
|
---|
| 1206 | <xsl:when test="contains($text,'<') and contains($text, '&')
|
---|
| 1207 | and string-length($ltpos) < string-length($amppos)">
|
---|
| 1208 | <xsl:value-of select="$ltpos"/>
|
---|
| 1209 | <xsl:text>&lt;</xsl:text>
|
---|
| 1210 | <xsl:call-template name="escape-text">
|
---|
| 1211 | <xsl:with-param name="text" select="substring-after($text, '<')"/>
|
---|
| 1212 | </xsl:call-template>
|
---|
| 1213 | </xsl:when>
|
---|
| 1214 |
|
---|
| 1215 | <xsl:when test="contains($text,'<') and contains($text, '&')
|
---|
| 1216 | and string-length($amppos) < string-length($ltpos)">
|
---|
| 1217 | <xsl:value-of select="$amppos"/>
|
---|
| 1218 | <xsl:text>&amp;</xsl:text>
|
---|
| 1219 | <xsl:call-template name="escape-text">
|
---|
| 1220 | <xsl:with-param name="text" select="substring-after($text, '&')"/>
|
---|
| 1221 | </xsl:call-template>
|
---|
| 1222 | </xsl:when>
|
---|
| 1223 |
|
---|
| 1224 | <xsl:when test="contains($text, '<')">
|
---|
| 1225 | <xsl:value-of select="$ltpos"/>
|
---|
| 1226 | <xsl:text>&lt;</xsl:text>
|
---|
| 1227 | <xsl:call-template name="escape-text">
|
---|
| 1228 | <xsl:with-param name="text" select="substring-after($text, '<')"/>
|
---|
| 1229 | </xsl:call-template>
|
---|
| 1230 | </xsl:when>
|
---|
| 1231 |
|
---|
| 1232 | <xsl:when test="contains($text, '&')">
|
---|
| 1233 | <xsl:value-of select="$amppos"/>
|
---|
| 1234 | <xsl:text>&amp;</xsl:text>
|
---|
| 1235 | <xsl:call-template name="escape-text">
|
---|
| 1236 | <xsl:with-param name="text" select="substring-after($text, '&')"/>
|
---|
| 1237 | </xsl:call-template>
|
---|
| 1238 | </xsl:when>
|
---|
| 1239 |
|
---|
| 1240 | <xsl:otherwise>
|
---|
| 1241 | <xsl:value-of select="$text"/>
|
---|
| 1242 | </xsl:otherwise>
|
---|
| 1243 | </xsl:choose>
|
---|
| 1244 | </xsl:template>
|
---|
| 1245 |
|
---|
| 1246 | <xsl:template name="index.separator">
|
---|
| 1247 | <xsl:param name="key" select="''"/>
|
---|
| 1248 | <xsl:param name="lang">
|
---|
| 1249 | <xsl:call-template name="l10n.language"/>
|
---|
| 1250 | </xsl:param>
|
---|
| 1251 |
|
---|
| 1252 | <xsl:choose>
|
---|
| 1253 | <xsl:when test="$key = 'index.term.separator'">
|
---|
| 1254 | <xsl:choose>
|
---|
| 1255 | <!-- Use the override if not blank -->
|
---|
| 1256 | <xsl:when test="$index.term.separator != ''">
|
---|
| 1257 | <xsl:copy-of select="$index.term.separator"/>
|
---|
| 1258 | </xsl:when>
|
---|
| 1259 | <xsl:otherwise>
|
---|
| 1260 | <xsl:call-template name="gentext.template">
|
---|
| 1261 | <xsl:with-param name="lang" select="$lang"/>
|
---|
| 1262 | <xsl:with-param name="context">index</xsl:with-param>
|
---|
| 1263 | <xsl:with-param name="name">term-separator</xsl:with-param>
|
---|
| 1264 | </xsl:call-template>
|
---|
| 1265 | </xsl:otherwise>
|
---|
| 1266 | </xsl:choose>
|
---|
| 1267 | </xsl:when>
|
---|
| 1268 | <xsl:when test="$key = 'index.number.separator'">
|
---|
| 1269 | <xsl:choose>
|
---|
| 1270 | <!-- Use the override if not blank -->
|
---|
| 1271 | <xsl:when test="$index.number.separator != ''">
|
---|
| 1272 | <xsl:copy-of select="$index.number.separator"/>
|
---|
| 1273 | </xsl:when>
|
---|
| 1274 | <xsl:otherwise>
|
---|
| 1275 | <xsl:call-template name="gentext.template">
|
---|
| 1276 | <xsl:with-param name="lang" select="$lang"/>
|
---|
| 1277 | <xsl:with-param name="context">index</xsl:with-param>
|
---|
| 1278 | <xsl:with-param name="name">number-separator</xsl:with-param>
|
---|
| 1279 | </xsl:call-template>
|
---|
| 1280 | </xsl:otherwise>
|
---|
| 1281 | </xsl:choose>
|
---|
| 1282 | </xsl:when>
|
---|
| 1283 | <xsl:when test="$key = 'index.range.separator'">
|
---|
| 1284 | <xsl:choose>
|
---|
| 1285 | <!-- Use the override if not blank -->
|
---|
| 1286 | <xsl:when test="$index.range.separator != ''">
|
---|
| 1287 | <xsl:copy-of select="$index.range.separator"/>
|
---|
| 1288 | </xsl:when>
|
---|
| 1289 | <xsl:otherwise>
|
---|
| 1290 | <xsl:call-template name="gentext.template">
|
---|
| 1291 | <xsl:with-param name="lang" select="$lang"/>
|
---|
| 1292 | <xsl:with-param name="context">index</xsl:with-param>
|
---|
| 1293 | <xsl:with-param name="name">range-separator</xsl:with-param>
|
---|
| 1294 | </xsl:call-template>
|
---|
| 1295 | </xsl:otherwise>
|
---|
| 1296 | </xsl:choose>
|
---|
| 1297 | </xsl:when>
|
---|
| 1298 | </xsl:choose>
|
---|
| 1299 | </xsl:template>
|
---|
| 1300 |
|
---|
| 1301 | </xsl:stylesheet>
|
---|