[ae8a3e4] | 1 | <?xml version='1.0' encoding='ISO-8859-1'?>
|
---|
| 2 | <!DOCTYPE xsl:stylesheet [
|
---|
| 3 | <!ENTITY lowercase "'abcdefghijklmnopqrstuvwxyz'">
|
---|
| 4 | <!ENTITY uppercase "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'">
|
---|
| 5 | <!ENTITY primary 'normalize-space(concat(primary/@sortas, primary[not(@sortas)]))'>
|
---|
| 6 | <!ENTITY scope 'count(ancestor::node()|$scope) = count(ancestor::node())'>
|
---|
| 7 | ]>
|
---|
| 8 |
|
---|
| 9 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
| 10 | xmlns="http://www.w3.org/1999/xhtml"
|
---|
| 11 | version="1.0">
|
---|
| 12 |
|
---|
| 13 | <!--Filename-->
|
---|
| 14 | <xsl:template match="index" mode="recursive-chunk-filename">
|
---|
| 15 | <xsl:text>longindex.html</xsl:text>
|
---|
| 16 | </xsl:template>
|
---|
| 17 |
|
---|
| 18 | <!--Title-->
|
---|
[239e8ca] | 19 | <xsl:param name="index-title">Index</xsl:param>
|
---|
[5d4975d] | 20 |
|
---|
[ae8a3e4] | 21 | <xsl:template match="index" mode="title.markup">
|
---|
[e7ce829] | 22 | <xsl:call-template name="gentext">
|
---|
| 23 | <xsl:with-param name="key" select="$index-title"/>
|
---|
| 24 | </xsl:call-template>
|
---|
[ae8a3e4] | 25 | </xsl:template>
|
---|
[5d4975d] | 26 |
|
---|
| 27 | <xsl:template name="index.titlepage">
|
---|
| 28 | <div class="titlepage">
|
---|
| 29 | <h1 class="index">
|
---|
[e7ce829] | 30 | <xsl:call-template name="gentext">
|
---|
| 31 | <xsl:with-param name="key" select="$index-title"/>
|
---|
| 32 | </xsl:call-template>
|
---|
[5d4975d] | 33 | </h1>
|
---|
| 34 | </div>
|
---|
| 35 | </xsl:template>
|
---|
[ae8a3e4] | 36 |
|
---|
| 37 | <!--Divisions-->
|
---|
| 38 | <xsl:template match="indexterm" mode="index-div">
|
---|
| 39 | <xsl:param name="scope" select="."/>
|
---|
| 40 | <xsl:variable name="key" select="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
|
---|
| 41 | <xsl:variable name="divtitle" select="translate($key, &lowercase;, &uppercase;)"/>
|
---|
| 42 | <!-- Make sure that we don't generate a div if there are no terms in scope -->
|
---|
| 43 | <xsl:if test="key('letter', $key)[&scope;] [count(.|key('primary', &primary;)[&scope;][1]) = 1]">
|
---|
| 44 | <div class="indexdiv">
|
---|
| 45 | <xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)">
|
---|
| 46 | <h2>
|
---|
[0ef1837] | 47 | <xsl:choose>
|
---|
| 48 | <xsl:when test="$divtitle = 'A'">
|
---|
[ee1c43a] | 49 | <a id="package-index" name="package-index"/>
|
---|
[e7ce829] | 50 | <xsl:call-template name="gentext">
|
---|
| 51 | <xsl:with-param name="key">Packages</xsl:with-param>
|
---|
| 52 | </xsl:call-template>
|
---|
[ae8a3e4] | 53 | </xsl:when>
|
---|
| 54 | <xsl:when test="$divtitle = 'B'">
|
---|
[ee1c43a] | 55 | <a id="program-index" name="program-index"/>
|
---|
[e7ce829] | 56 | <xsl:call-template name="gentext">
|
---|
| 57 | <xsl:with-param name="key">Programs</xsl:with-param>
|
---|
| 58 | </xsl:call-template>
|
---|
[ae8a3e4] | 59 | </xsl:when>
|
---|
| 60 | <xsl:when test="$divtitle = 'C'">
|
---|
[ee1c43a] | 61 | <a id="library-index" name="library-index"/>
|
---|
[e7ce829] | 62 | <xsl:call-template name="gentext">
|
---|
| 63 | <xsl:with-param name="key">Libraries</xsl:with-param>
|
---|
| 64 | </xsl:call-template>
|
---|
[ae8a3e4] | 65 | </xsl:when>
|
---|
| 66 | <xsl:when test="$divtitle = 'D'">
|
---|
[ee1c43a] | 67 | <a id="kernel-config-index" name="kernel-config-index"/>
|
---|
[e7ce829] | 68 | <xsl:call-template name="gentext">
|
---|
| 69 | <xsl:with-param name="key">Kernel Configuration</xsl:with-param>
|
---|
| 70 | </xsl:call-template>
|
---|
[ae8a3e4] | 71 | </xsl:when>
|
---|
[0ef1837] | 72 | <xsl:when test="$divtitle = 'E'">
|
---|
[ee1c43a] | 73 | <a id="config-file-index" name="config-file-index"/>
|
---|
[e7ce829] | 74 | <xsl:call-template name="gentext">
|
---|
| 75 | <xsl:with-param name="key">Configuration Files</xsl:with-param>
|
---|
| 76 | </xsl:call-template>
|
---|
[0ef1837] | 77 | </xsl:when>
|
---|
| 78 | <xsl:when test="$divtitle = 'F'">
|
---|
[ee1c43a] | 79 | <a id="bootscript-index" name="bootscript-index"/>
|
---|
[e7ce829] | 80 | <xsl:call-template name="gentext">
|
---|
| 81 | <xsl:with-param name="key">Bootscripts</xsl:with-param>
|
---|
| 82 | </xsl:call-template>
|
---|
[0ef1837] | 83 | </xsl:when>
|
---|
| 84 | <xsl:when test="$divtitle = 'G'">
|
---|
[ee1c43a] | 85 | <a id="other-index" name="other-index"/>
|
---|
[e7ce829] | 86 | <xsl:call-template name="gentext">
|
---|
| 87 | <xsl:with-param name="key">Others</xsl:with-param>
|
---|
| 88 | </xsl:call-template>
|
---|
[0ef1837] | 89 | </xsl:when>
|
---|
[ae8a3e4] | 90 | <xsl:otherwise>
|
---|
[0ef1837] | 91 | <xsl:value-of select="$divtitle"/>
|
---|
| 92 | </xsl:otherwise>
|
---|
[ae8a3e4] | 93 | </xsl:choose>
|
---|
| 94 | </h2>
|
---|
| 95 | </xsl:if>
|
---|
| 96 | <ul>
|
---|
| 97 | <xsl:apply-templates select="key('letter', $key)[&scope;]
|
---|
| 98 | [count(.|key('primary', &primary;)[&scope;][1])=1]" mode="index-primary">
|
---|
| 99 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 100 | <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
---|
| 101 | </xsl:apply-templates>
|
---|
| 102 | </ul>
|
---|
| 103 | </div>
|
---|
| 104 | </xsl:if>
|
---|
| 105 | </xsl:template>
|
---|
| 106 |
|
---|
| 107 | <!-- Dropping the separator from here-->
|
---|
| 108 | <xsl:template match="indexterm" mode="reference">
|
---|
| 109 | <xsl:param name="scope" select="."/>
|
---|
| 110 | <xsl:call-template name="reference">
|
---|
| 111 | <xsl:with-param name="zones" select="normalize-space(@zone)"/>
|
---|
| 112 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 113 | </xsl:call-template>
|
---|
| 114 | </xsl:template>
|
---|
| 115 |
|
---|
| 116 | <!-- Changing the output tags and re-addind the separator-->
|
---|
| 117 | <xsl:template match="indexterm" mode="index-primary">
|
---|
| 118 | <xsl:param name="scope" select="."/>
|
---|
| 119 | <xsl:variable name="key" select="&primary;"/>
|
---|
| 120 | <xsl:variable name="refs" select="key('primary', $key)[&scope;]"/>
|
---|
| 121 | <li>
|
---|
| 122 | <strong class="item">
|
---|
| 123 | <xsl:value-of select="primary"/>
|
---|
| 124 | <xsl:text>: </xsl:text>
|
---|
[5e363b3] | 125 | </strong><div class='indexref'>
|
---|
[ae8a3e4] | 126 | <xsl:for-each select="$refs[generate-id() = generate-id(key('primary-section',
|
---|
| 127 | concat($key, " ", generate-id((ancestor-or-self::book |ancestor-or-self::part
|
---|
| 128 | |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface
|
---|
| 129 | |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3
|
---|
| 130 | |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::index)[last()])))[&scope;][1])]">
|
---|
| 131 | <xsl:apply-templates select="." mode="reference">
|
---|
| 132 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 133 | </xsl:apply-templates>
|
---|
| 134 | </xsl:for-each>
|
---|
| 135 | <xsl:if test="$refs/secondary">
|
---|
| 136 | <ul>
|
---|
| 137 | <xsl:apply-templates select="$refs[secondary and count(.|key('secondary',
|
---|
| 138 | concat($key, " ", normalize-space(concat(secondary/@sortas,
|
---|
| 139 | secondary[not(@sortas)]))))[&scope;][1]) = 1]" mode="index-secondary">
|
---|
| 140 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 141 | <xsl:sort select="translate(normalize-space(concat(secondary/@sortas,
|
---|
| 142 | secondary[not(@sortas)])), &lowercase;, &uppercase;)"/>
|
---|
| 143 | </xsl:apply-templates>
|
---|
| 144 | </ul>
|
---|
| 145 | </xsl:if>
|
---|
[5e363b3] | 146 | </div></li>
|
---|
[ae8a3e4] | 147 | </xsl:template>
|
---|
[5d4975d] | 148 |
|
---|
[ae8a3e4] | 149 | <xsl:template match="indexterm" mode="index-secondary">
|
---|
| 150 | <xsl:param name="scope" select="."/>
|
---|
| 151 | <xsl:variable name="key" select="concat(&primary;, " ",
|
---|
| 152 | normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])))"/>
|
---|
| 153 | <xsl:variable name="refs" select="key('secondary', $key)[&scope;]"/>
|
---|
| 154 | <li>
|
---|
| 155 | <strong class="secitem">
|
---|
| 156 | <xsl:value-of select="secondary"/>
|
---|
| 157 | <xsl:text>: </xsl:text>
|
---|
| 158 | </strong>
|
---|
| 159 | <xsl:for-each select="$refs[generate-id() = generate-id(key('secondary-section',
|
---|
| 160 | concat($key, " ", generate-id((ancestor-or-self::book |ancestor-or-self::part
|
---|
| 161 | |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface
|
---|
| 162 | |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3
|
---|
| 163 | |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::index)[last()])))[&scope;][1])]">
|
---|
| 164 | <xsl:apply-templates select="." mode="reference">
|
---|
| 165 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 166 | </xsl:apply-templates>
|
---|
| 167 | </xsl:for-each>
|
---|
| 168 | </li>
|
---|
| 169 | </xsl:template>
|
---|
| 170 |
|
---|
| 171 | <!--Links (This template also fix a bug in the original code)-->
|
---|
| 172 | <xsl:template name="reference">
|
---|
| 173 | <xsl:param name="scope" select="."/>
|
---|
| 174 | <xsl:param name="zones"/>
|
---|
| 175 | <xsl:choose>
|
---|
| 176 | <xsl:when test="contains($zones, ' ')">
|
---|
| 177 | <xsl:variable name="zone" select="substring-before($zones, ' ')"/>
|
---|
| 178 | <xsl:variable name="zone2" select="substring-after($zones, ' ')"/>
|
---|
| 179 | <xsl:variable name="target" select="key('sections', $zone)[&scope;]"/>
|
---|
| 180 | <xsl:variable name="target2" select="key('sections', $zone2)[&scope;]"/>
|
---|
| 181 | <a>
|
---|
| 182 | <xsl:attribute name="href">
|
---|
| 183 | <xsl:call-template name="href.target.uri">
|
---|
| 184 | <xsl:with-param name="object" select="$target[1]"/>
|
---|
| 185 | </xsl:call-template>
|
---|
| 186 | </xsl:attribute>
|
---|
| 187 | <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
|
---|
| 188 | </a>
|
---|
| 189 | <xsl:text> -- </xsl:text>
|
---|
| 190 | <a>
|
---|
| 191 | <xsl:attribute name="href">
|
---|
| 192 | <xsl:call-template name="href.target.uri">
|
---|
| 193 | <xsl:with-param name="object" select="$target2[1]"/>
|
---|
| 194 | </xsl:call-template>
|
---|
| 195 | </xsl:attribute>
|
---|
[e7ce829] | 196 | <xsl:call-template name="gentext">
|
---|
| 197 | <xsl:with-param name="key">description</xsl:with-param>
|
---|
| 198 | </xsl:call-template>
|
---|
[5e363b3] | 199 | </a><br />
|
---|
[ae8a3e4] | 200 | </xsl:when>
|
---|
| 201 | <xsl:otherwise>
|
---|
| 202 | <xsl:variable name="zone" select="$zones"/>
|
---|
| 203 | <xsl:variable name="target" select="key('sections', $zone)[&scope;]"/>
|
---|
| 204 | <a>
|
---|
| 205 | <xsl:attribute name="href">
|
---|
| 206 | <xsl:call-template name="href.target.uri">
|
---|
| 207 | <xsl:with-param name="object" select="$target[1]"/>
|
---|
| 208 | </xsl:call-template>
|
---|
| 209 | </xsl:attribute>
|
---|
| 210 | <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
|
---|
| 211 | </a>
|
---|
| 212 | </xsl:otherwise>
|
---|
| 213 | </xsl:choose>
|
---|
| 214 | </xsl:template>
|
---|
[5d4975d] | 215 |
|
---|
| 216 | <!-- Dropping unneeded anchors -->
|
---|
| 217 | <xsl:template match="indexterm"/>
|
---|
[ae8a3e4] | 218 |
|
---|
| 219 | </xsl:stylesheet>
|
---|