| 1 |
<?xml version="1.0" encoding="ASCII"?><!--This file was created automatically by html2xhtml--><!--from the HTML stylesheets.--><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="d" version="1.0"> |
| 2 |
|
| 3 |
<!-- ******************************************************************** |
| 4 |
|
| 5 |
This file is part of the XSL DocBook Stylesheet distribution. |
| 6 |
See ../README or http://cdn.docbook.org/release/xsl/current/ for |
| 7 |
copyright and other information. |
| 8 |
|
| 9 |
******************************************************************** --> |
| 10 |
|
| 11 |
<!-- ==================================================================== --> |
| 12 |
|
| 13 |
<xsl:template match="d:index"> |
| 14 |
<!-- some implementations use completely empty index tags to indicate --> |
| 15 |
<!-- where an automatically generated index should be inserted. so --> |
| 16 |
<!-- if the index is completely empty, skip it. Unless generate.index --> |
| 17 |
<!-- is non-zero, in which case, this is where the automatically --> |
| 18 |
<!-- generated index should go. --> |
| 19 |
|
| 20 |
<xsl:call-template name="id.warning"/> |
| 21 |
|
| 22 |
<xsl:if test="count(*)>0 or $generate.index != '0'"> |
| 23 |
<div> |
| 24 |
<xsl:apply-templates select="." mode="common.html.attributes"/> |
| 25 |
<xsl:call-template name="id.attribute"> |
| 26 |
<xsl:with-param name="conditional" select="0"/> |
| 27 |
</xsl:call-template> |
| 28 |
|
| 29 |
<xsl:call-template name="index.titlepage"/> |
| 30 |
<xsl:choose> |
| 31 |
<xsl:when test="d:indexdiv"> |
| 32 |
<xsl:apply-templates/> |
| 33 |
</xsl:when> |
| 34 |
<xsl:otherwise> |
| 35 |
<xsl:apply-templates select="*[not(self::d:indexentry)]"/> |
| 36 |
<!-- Because it's actually valid for Index to have neither any --> |
| 37 |
<!-- Indexdivs nor any Indexentries, we need to check and make --> |
| 38 |
<!-- sure that at least one Indexentry exists, and generate a --> |
| 39 |
<!-- wrapper dl if there is at least one; otherwise, do nothing. --> |
| 40 |
<xsl:if test="d:indexentry"> |
| 41 |
<!-- The indexentry template assumes a parent dl wrapper has --> |
| 42 |
<!-- been generated; for Indexes that have Indexdivs, the dl --> |
| 43 |
<!-- wrapper is generated by the indexdiv template; however, --> |
| 44 |
<!-- for Indexes that lack Indexdivs, if we don't generate a --> |
| 45 |
<!-- dl here, HTML output will not be valid. --> |
| 46 |
<dl> |
| 47 |
<xsl:apply-templates select="d:indexentry"/> |
| 48 |
</dl> |
| 49 |
</xsl:if> |
| 50 |
</xsl:otherwise> |
| 51 |
</xsl:choose> |
| 52 |
|
| 53 |
<xsl:if test="count(d:indexentry) = 0 and count(d:indexdiv) = 0"> |
| 54 |
<xsl:call-template name="generate-index"> |
| 55 |
<xsl:with-param name="scope" select="(ancestor::d:book|/)[last()]"/> |
| 56 |
</xsl:call-template> |
| 57 |
</xsl:if> |
| 58 |
|
| 59 |
<xsl:if test="not(parent::d:article)"> |
| 60 |
<xsl:call-template name="process.footnotes"/> |
| 61 |
</xsl:if> |
| 62 |
</div> |
| 63 |
</xsl:if> |
| 64 |
</xsl:template> |
| 65 |
|
| 66 |
<xsl:template match="d:setindex"> |
| 67 |
<!-- some implementations use completely empty index tags to indicate --> |
| 68 |
<!-- where an automatically generated index should be inserted. so --> |
| 69 |
<!-- if the index is completely empty, skip it. Unless generate.index --> |
| 70 |
<!-- is non-zero, in which case, this is where the automatically --> |
| 71 |
<!-- generated index should go. --> |
| 72 |
|
| 73 |
<xsl:call-template name="id.warning"/> |
| 74 |
|
| 75 |
<xsl:if test="count(*)>0 or $generate.index != '0'"> |
| 76 |
<div> |
| 77 |
<xsl:apply-templates select="." mode="common.html.attributes"/> |
| 78 |
<xsl:call-template name="id.attribute"> |
| 79 |
<xsl:with-param name="conditional" select="0"/> |
| 80 |
</xsl:call-template> |
| 81 |
|
| 82 |
<xsl:call-template name="setindex.titlepage"/> |
| 83 |
<xsl:apply-templates/> |
| 84 |
|
| 85 |
<xsl:if test="count(d:indexentry) = 0 and count(d:indexdiv) = 0"> |
| 86 |
<xsl:call-template name="generate-index"> |
| 87 |
<xsl:with-param name="scope" select="/"/> |
| 88 |
</xsl:call-template> |
| 89 |
</xsl:if> |
| 90 |
|
| 91 |
<xsl:if test="not(parent::d:article)"> |
| 92 |
<xsl:call-template name="process.footnotes"/> |
| 93 |
</xsl:if> |
| 94 |
</div> |
| 95 |
</xsl:if> |
| 96 |
</xsl:template> |
| 97 |
|
| 98 |
<xsl:template match="d:index/d:indexinfo"/> |
| 99 |
<xsl:template match="d:index/d:info"/> |
| 100 |
<xsl:template match="d:index/d:title"/> |
| 101 |
<xsl:template match="d:index/d:subtitle"/> |
| 102 |
<xsl:template match="d:index/d:titleabbrev"/> |
| 103 |
|
| 104 |
<!-- ==================================================================== --> |
| 105 |
|
| 106 |
<xsl:template match="d:indexdiv"> |
| 107 |
<xsl:call-template name="id.warning"/> |
| 108 |
|
| 109 |
<div> |
| 110 |
<xsl:apply-templates select="." mode="common.html.attributes"/> |
| 111 |
<xsl:call-template name="id.attribute"/> |
| 112 |
<xsl:call-template name="anchor"/> |
| 113 |
<xsl:apply-templates select="*[not(self::d:indexentry)]"/> |
| 114 |
<dl> |
| 115 |
<xsl:apply-templates select="d:indexentry"/> |
| 116 |
</dl> |
| 117 |
</div> |
| 118 |
</xsl:template> |
| 119 |
|
| 120 |
<xsl:template match="d:indexdiv/d:title"> |
| 121 |
<h3> |
| 122 |
<xsl:apply-templates select="." mode="common.html.attributes"/> |
| 123 |
<xsl:apply-templates/> |
| 124 |
</h3> |
| 125 |
</xsl:template> |
| 126 |
|
| 127 |
<xsl:template match="d:indexdiv/d:subtitle"> |
| 128 |
<h4> |
| 129 |
<xsl:apply-templates select="." mode="common.html.attributes"/> |
| 130 |
<xsl:apply-templates/> |
| 131 |
</h4> |
| 132 |
</xsl:template> |
| 133 |
|
| 134 |
<!-- ==================================================================== --> |
| 135 |
|
| 136 |
<xsl:template match="d:indexterm"> |
| 137 |
<!-- this one must have a name, even if it doesn't have an ID --> |
| 138 |
<xsl:variable name="id"> |
| 139 |
<xsl:call-template name="object.id"/> |
| 140 |
</xsl:variable> |
| 141 |
|
| 142 |
<a id="{$id}" class="indexterm"/> |
| 143 |
</xsl:template> |
| 144 |
|
| 145 |
<xsl:template match="d:primary|d:secondary|d:tertiary|d:see|d:seealso"> |
| 146 |
</xsl:template> |
| 147 |
|
| 148 |
<!-- ==================================================================== --> |
| 149 |
|
| 150 |
<xsl:template match="d:indexentry"> |
| 151 |
<xsl:apply-templates select="d:primaryie"/> |
| 152 |
</xsl:template> |
| 153 |
|
| 154 |
<xsl:template match="d:primaryie"> |
| 155 |
<dt> |
| 156 |
<xsl:apply-templates/> |
| 157 |
</dt> |
| 158 |
<dd> |
| 159 |
<xsl:apply-templates select="following-sibling::d:seeie [not(preceding-sibling::d:secondaryie)]" mode="indexentry"/> |
| 160 |
<xsl:apply-templates select="following-sibling::d:seealsoie [not(preceding-sibling::d:secondaryie)]" mode="indexentry"/> |
| 161 |
<xsl:apply-templates select="following-sibling::d:secondaryie" mode="indexentry"/> |
| 162 |
</dd> |
| 163 |
</xsl:template> |
| 164 |
|
| 165 |
<!-- Handled in mode to convert flat list to structured output --> |
| 166 |
<xsl:template match="d:secondaryie"> |
| 167 |
</xsl:template> |
| 168 |
<xsl:template match="d:tertiaryie"> |
| 169 |
</xsl:template> |
| 170 |
<xsl:template match="d:seeie|d:seealsoie"> |
| 171 |
</xsl:template> |
| 172 |
|
| 173 |
<xsl:template match="d:secondaryie" mode="indexentry"> |
| 174 |
<dl> |
| 175 |
<dt> |
| 176 |
<xsl:apply-templates/> |
| 177 |
</dt> |
| 178 |
<dd> |
| 179 |
<!-- select following see* elements up to next secondaryie or tertiary or end --> |
| 180 |
<xsl:variable name="after.this" select="following-sibling::*"/> |
| 181 |
<xsl:variable name="next.entry" select="(following-sibling::d:secondaryie|following-sibling::d:tertiaryie)[1]"/> |
| 182 |
<xsl:variable name="before.entry" select="$next.entry/preceding-sibling::*"/> |
| 183 |
<xsl:variable name="see.intersection" select="$after.this[count(.|$before.entry) = count($before.entry)] [self::d:seeie or self::d:seealsoie]"/> |
| 184 |
<xsl:choose> |
| 185 |
<xsl:when test="count($see.intersection) != 0"> |
| 186 |
<xsl:apply-templates select="$see.intersection" mode="indexentry"/> |
| 187 |
</xsl:when> |
| 188 |
<xsl:when test="count($next.entry) = 0"> |
| 189 |
<xsl:apply-templates select="following-sibling::d:seeie" mode="indexentry"/> |
| 190 |
<xsl:apply-templates select="following-sibling::d:seealsoie" mode="indexentry"/> |
| 191 |
</xsl:when> |
| 192 |
</xsl:choose> |
| 193 |
|
| 194 |
<!-- now process any tertiaryie before the next secondaryie --> |
| 195 |
<xsl:variable name="before.next.secondary" select="following-sibling::d:secondaryie[1]/preceding-sibling::*"/> |
| 196 |
<xsl:variable name="tertiary.intersection" select="$after.this[count(.|$before.next.secondary) = count($before.next.secondary)] [not(self::d:seeie) and not(self::d:seealsoie)]"/> |
| 197 |
<xsl:choose> |
| 198 |
<xsl:when test="count($tertiary.intersection) != 0"> |
| 199 |
<xsl:apply-templates select="$tertiary.intersection" mode="indexentry"/> |
| 200 |
</xsl:when> |
| 201 |
<xsl:when test="not(following-sibling::d:secondaryie)"> |
| 202 |
<xsl:apply-templates select="following-sibling::d:tertiaryie" mode="indexentry"/> |
| 203 |
</xsl:when> |
| 204 |
</xsl:choose> |
| 205 |
</dd> |
| 206 |
</dl> |
| 207 |
</xsl:template> |
| 208 |
|
| 209 |
<xsl:template match="d:tertiaryie" mode="indexentry"> |
| 210 |
<dl> |
| 211 |
<dt> |
| 212 |
<xsl:apply-templates/> |
| 213 |
</dt> |
| 214 |
<dd> |
| 215 |
<!-- select following see* elements up to next secondaryie or tertiary or end --> |
| 216 |
<xsl:variable name="after.this" select="following-sibling::*"/> |
| 217 |
<xsl:variable name="next.entry" select="(following-sibling::d:secondaryie|following-sibling::d:tertiaryie)[1]"/> |
| 218 |
<xsl:variable name="before.entry" select="$next.entry/preceding-sibling::*"/> |
| 219 |
<xsl:variable name="see.intersection" select="$after.this[count(.|$before.entry) = count($before.entry)] [self::d:seeie or self::d:seealsoie]"/> |
| 220 |
<xsl:choose> |
| 221 |
<xsl:when test="count($see.intersection) != 0"> |
| 222 |
<xsl:apply-templates select="$see.intersection" mode="indexentry"/> |
| 223 |
</xsl:when> |
| 224 |
<xsl:when test="count($next.entry) = 0"> |
| 225 |
<xsl:apply-templates select="following-sibling::d:seeie" mode="indexentry"/> |
| 226 |
<xsl:apply-templates select="following-sibling::d:seealsoie" mode="indexentry"/> |
| 227 |
</xsl:when> |
| 228 |
</xsl:choose> |
| 229 |
</dd> |
| 230 |
</dl> |
| 231 |
</xsl:template> |
| 232 |
|
| 233 |
<xsl:template match="d:seeie" mode="indexentry"> |
| 234 |
<dt> |
| 235 |
<xsl:text>(</xsl:text> |
| 236 |
<xsl:call-template name="gentext"> |
| 237 |
<xsl:with-param name="key" select="'see'"/> |
| 238 |
</xsl:call-template> |
| 239 |
<xsl:text> </xsl:text> |
| 240 |
<xsl:apply-templates/> |
| 241 |
<xsl:text>)</xsl:text> |
| 242 |
</dt> |
| 243 |
</xsl:template> |
| 244 |
|
| 245 |
<xsl:template match="d:seealsoie" mode="indexentry"> |
| 246 |
<div> |
| 247 |
<xsl:text>(</xsl:text> |
| 248 |
<xsl:call-template name="gentext"> |
| 249 |
<xsl:with-param name="key" select="'seealso'"/> |
| 250 |
</xsl:call-template> |
| 251 |
<xsl:text> </xsl:text> |
| 252 |
<xsl:apply-templates/> |
| 253 |
<xsl:text>)</xsl:text> |
| 254 |
</div> |
| 255 |
</xsl:template> |
| 256 |
|
| 257 |
</xsl:stylesheet> |