[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>
|
---|
[1443f74e] | 33 | </h1>
|
---|
| 34 | <!-- Temporary addition until index is done -->
|
---|
| 35 | <div class="note">
|
---|
| 36 | <div class="admonhead">
|
---|
| 37 | <img alt="[Note]" src="../images/note.png" />
|
---|
| 38 | <h3 class="admontitle">
|
---|
| 39 | Note
|
---|
| 40 | </h3>
|
---|
| 41 | </div>
|
---|
| 42 | <div class="admonbody">
|
---|
| 43 | <p>
|
---|
| 44 | At this time, the index is incomplete. Additional entries
|
---|
| 45 | will be added as time permits.
|
---|
| 46 | </p>
|
---|
| 47 | </div>
|
---|
| 48 | </div>
|
---|
| 49 | <!-- End temporary addition -->
|
---|
[5d4975d] | 50 | </div>
|
---|
| 51 | </xsl:template>
|
---|
[ae8a3e4] | 52 |
|
---|
| 53 | <!--Divisions-->
|
---|
| 54 | <xsl:template match="indexterm" mode="index-div">
|
---|
| 55 | <xsl:param name="scope" select="."/>
|
---|
| 56 | <xsl:variable name="key" select="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
|
---|
| 57 | <xsl:variable name="divtitle" select="translate($key, &lowercase;, &uppercase;)"/>
|
---|
| 58 | <!-- Make sure that we don't generate a div if there are no terms in scope -->
|
---|
| 59 | <xsl:if test="key('letter', $key)[&scope;] [count(.|key('primary', &primary;)[&scope;][1]) = 1]">
|
---|
| 60 | <div class="indexdiv">
|
---|
| 61 | <xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)">
|
---|
| 62 | <h2>
|
---|
[0ef1837] | 63 | <xsl:choose>
|
---|
| 64 | <xsl:when test="$divtitle = 'A'">
|
---|
[ee1c43a] | 65 | <a id="package-index" name="package-index"/>
|
---|
[e7ce829] | 66 | <xsl:call-template name="gentext">
|
---|
| 67 | <xsl:with-param name="key">Packages</xsl:with-param>
|
---|
| 68 | </xsl:call-template>
|
---|
[ae8a3e4] | 69 | </xsl:when>
|
---|
| 70 | <xsl:when test="$divtitle = 'B'">
|
---|
[ee1c43a] | 71 | <a id="program-index" name="program-index"/>
|
---|
[e7ce829] | 72 | <xsl:call-template name="gentext">
|
---|
| 73 | <xsl:with-param name="key">Programs</xsl:with-param>
|
---|
| 74 | </xsl:call-template>
|
---|
[ae8a3e4] | 75 | </xsl:when>
|
---|
| 76 | <xsl:when test="$divtitle = 'C'">
|
---|
[ee1c43a] | 77 | <a id="library-index" name="library-index"/>
|
---|
[e7ce829] | 78 | <xsl:call-template name="gentext">
|
---|
| 79 | <xsl:with-param name="key">Libraries</xsl:with-param>
|
---|
| 80 | </xsl:call-template>
|
---|
[ae8a3e4] | 81 | </xsl:when>
|
---|
| 82 | <xsl:when test="$divtitle = 'D'">
|
---|
[ee1c43a] | 83 | <a id="kernel-config-index" name="kernel-config-index"/>
|
---|
[e7ce829] | 84 | <xsl:call-template name="gentext">
|
---|
| 85 | <xsl:with-param name="key">Kernel Configuration</xsl:with-param>
|
---|
| 86 | </xsl:call-template>
|
---|
[ae8a3e4] | 87 | </xsl:when>
|
---|
[0ef1837] | 88 | <xsl:when test="$divtitle = 'E'">
|
---|
[ee1c43a] | 89 | <a id="config-file-index" name="config-file-index"/>
|
---|
[e7ce829] | 90 | <xsl:call-template name="gentext">
|
---|
| 91 | <xsl:with-param name="key">Configuration Files</xsl:with-param>
|
---|
| 92 | </xsl:call-template>
|
---|
[0ef1837] | 93 | </xsl:when>
|
---|
| 94 | <xsl:when test="$divtitle = 'F'">
|
---|
[ee1c43a] | 95 | <a id="bootscript-index" name="bootscript-index"/>
|
---|
[e7ce829] | 96 | <xsl:call-template name="gentext">
|
---|
| 97 | <xsl:with-param name="key">Bootscripts</xsl:with-param>
|
---|
| 98 | </xsl:call-template>
|
---|
[0ef1837] | 99 | </xsl:when>
|
---|
| 100 | <xsl:when test="$divtitle = 'G'">
|
---|
[ee1c43a] | 101 | <a id="other-index" name="other-index"/>
|
---|
[e7ce829] | 102 | <xsl:call-template name="gentext">
|
---|
| 103 | <xsl:with-param name="key">Others</xsl:with-param>
|
---|
| 104 | </xsl:call-template>
|
---|
[0ef1837] | 105 | </xsl:when>
|
---|
[ae8a3e4] | 106 | <xsl:otherwise>
|
---|
[0ef1837] | 107 | <xsl:value-of select="$divtitle"/>
|
---|
| 108 | </xsl:otherwise>
|
---|
[ae8a3e4] | 109 | </xsl:choose>
|
---|
| 110 | </h2>
|
---|
| 111 | </xsl:if>
|
---|
| 112 | <ul>
|
---|
| 113 | <xsl:apply-templates select="key('letter', $key)[&scope;]
|
---|
| 114 | [count(.|key('primary', &primary;)[&scope;][1])=1]" mode="index-primary">
|
---|
| 115 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 116 | <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
---|
| 117 | </xsl:apply-templates>
|
---|
| 118 | </ul>
|
---|
| 119 | </div>
|
---|
| 120 | </xsl:if>
|
---|
| 121 | </xsl:template>
|
---|
| 122 |
|
---|
| 123 | <!-- Dropping the separator from here-->
|
---|
| 124 | <xsl:template match="indexterm" mode="reference">
|
---|
| 125 | <xsl:param name="scope" select="."/>
|
---|
| 126 | <xsl:call-template name="reference">
|
---|
| 127 | <xsl:with-param name="zones" select="normalize-space(@zone)"/>
|
---|
| 128 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 129 | </xsl:call-template>
|
---|
| 130 | </xsl:template>
|
---|
| 131 |
|
---|
| 132 | <!-- Changing the output tags and re-addind the separator-->
|
---|
| 133 | <xsl:template match="indexterm" mode="index-primary">
|
---|
| 134 | <xsl:param name="scope" select="."/>
|
---|
| 135 | <xsl:variable name="key" select="&primary;"/>
|
---|
| 136 | <xsl:variable name="refs" select="key('primary', $key)[&scope;]"/>
|
---|
| 137 | <li>
|
---|
| 138 | <strong class="item">
|
---|
| 139 | <xsl:value-of select="primary"/>
|
---|
| 140 | <xsl:text>: </xsl:text>
|
---|
[5e363b3] | 141 | </strong><div class='indexref'>
|
---|
[ae8a3e4] | 142 | <xsl:for-each select="$refs[generate-id() = generate-id(key('primary-section',
|
---|
| 143 | concat($key, " ", generate-id((ancestor-or-self::book |ancestor-or-self::part
|
---|
| 144 | |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface
|
---|
| 145 | |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3
|
---|
| 146 | |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::index)[last()])))[&scope;][1])]">
|
---|
| 147 | <xsl:apply-templates select="." mode="reference">
|
---|
| 148 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 149 | </xsl:apply-templates>
|
---|
| 150 | </xsl:for-each>
|
---|
| 151 | <xsl:if test="$refs/secondary">
|
---|
| 152 | <ul>
|
---|
| 153 | <xsl:apply-templates select="$refs[secondary and count(.|key('secondary',
|
---|
| 154 | concat($key, " ", normalize-space(concat(secondary/@sortas,
|
---|
| 155 | secondary[not(@sortas)]))))[&scope;][1]) = 1]" mode="index-secondary">
|
---|
| 156 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 157 | <xsl:sort select="translate(normalize-space(concat(secondary/@sortas,
|
---|
| 158 | secondary[not(@sortas)])), &lowercase;, &uppercase;)"/>
|
---|
| 159 | </xsl:apply-templates>
|
---|
| 160 | </ul>
|
---|
| 161 | </xsl:if>
|
---|
[5e363b3] | 162 | </div></li>
|
---|
[ae8a3e4] | 163 | </xsl:template>
|
---|
[5d4975d] | 164 |
|
---|
[ae8a3e4] | 165 | <xsl:template match="indexterm" mode="index-secondary">
|
---|
| 166 | <xsl:param name="scope" select="."/>
|
---|
| 167 | <xsl:variable name="key" select="concat(&primary;, " ",
|
---|
| 168 | normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])))"/>
|
---|
| 169 | <xsl:variable name="refs" select="key('secondary', $key)[&scope;]"/>
|
---|
| 170 | <li>
|
---|
| 171 | <strong class="secitem">
|
---|
| 172 | <xsl:value-of select="secondary"/>
|
---|
| 173 | <xsl:text>: </xsl:text>
|
---|
| 174 | </strong>
|
---|
| 175 | <xsl:for-each select="$refs[generate-id() = generate-id(key('secondary-section',
|
---|
| 176 | concat($key, " ", generate-id((ancestor-or-self::book |ancestor-or-self::part
|
---|
| 177 | |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface
|
---|
| 178 | |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3
|
---|
| 179 | |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::index)[last()])))[&scope;][1])]">
|
---|
| 180 | <xsl:apply-templates select="." mode="reference">
|
---|
| 181 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 182 | </xsl:apply-templates>
|
---|
| 183 | </xsl:for-each>
|
---|
| 184 | </li>
|
---|
| 185 | </xsl:template>
|
---|
| 186 |
|
---|
| 187 | <!--Links (This template also fix a bug in the original code)-->
|
---|
| 188 | <xsl:template name="reference">
|
---|
| 189 | <xsl:param name="scope" select="."/>
|
---|
| 190 | <xsl:param name="zones"/>
|
---|
| 191 | <xsl:choose>
|
---|
| 192 | <xsl:when test="contains($zones, ' ')">
|
---|
| 193 | <xsl:variable name="zone" select="substring-before($zones, ' ')"/>
|
---|
| 194 | <xsl:variable name="zone2" select="substring-after($zones, ' ')"/>
|
---|
| 195 | <xsl:variable name="target" select="key('sections', $zone)[&scope;]"/>
|
---|
| 196 | <xsl:variable name="target2" select="key('sections', $zone2)[&scope;]"/>
|
---|
| 197 | <a>
|
---|
| 198 | <xsl:attribute name="href">
|
---|
| 199 | <xsl:call-template name="href.target.uri">
|
---|
| 200 | <xsl:with-param name="object" select="$target[1]"/>
|
---|
| 201 | </xsl:call-template>
|
---|
| 202 | </xsl:attribute>
|
---|
| 203 | <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
|
---|
| 204 | </a>
|
---|
| 205 | <xsl:text> -- </xsl:text>
|
---|
| 206 | <a>
|
---|
| 207 | <xsl:attribute name="href">
|
---|
| 208 | <xsl:call-template name="href.target.uri">
|
---|
| 209 | <xsl:with-param name="object" select="$target2[1]"/>
|
---|
| 210 | </xsl:call-template>
|
---|
| 211 | </xsl:attribute>
|
---|
[e7ce829] | 212 | <xsl:call-template name="gentext">
|
---|
| 213 | <xsl:with-param name="key">description</xsl:with-param>
|
---|
| 214 | </xsl:call-template>
|
---|
[5e363b3] | 215 | </a><br />
|
---|
[ae8a3e4] | 216 | </xsl:when>
|
---|
| 217 | <xsl:otherwise>
|
---|
| 218 | <xsl:variable name="zone" select="$zones"/>
|
---|
| 219 | <xsl:variable name="target" select="key('sections', $zone)[&scope;]"/>
|
---|
| 220 | <a>
|
---|
| 221 | <xsl:attribute name="href">
|
---|
| 222 | <xsl:call-template name="href.target.uri">
|
---|
| 223 | <xsl:with-param name="object" select="$target[1]"/>
|
---|
| 224 | </xsl:call-template>
|
---|
| 225 | </xsl:attribute>
|
---|
| 226 | <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
|
---|
| 227 | </a>
|
---|
| 228 | </xsl:otherwise>
|
---|
| 229 | </xsl:choose>
|
---|
| 230 | </xsl:template>
|
---|
[5d4975d] | 231 |
|
---|
| 232 | <!-- Dropping unneeded anchors -->
|
---|
| 233 | <xsl:template match="indexterm"/>
|
---|
[ae8a3e4] | 234 |
|
---|
| 235 | </xsl:stylesheet>
|
---|