[0c43171] | 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-->
|
---|
[ded6ddd] | 19 | <xsl:param name="index-title">Index of packages and important installed files</xsl:param>
|
---|
| 20 |
|
---|
[0c43171] | 21 | <xsl:template match="index" mode="title.markup">
|
---|
[ded6ddd] | 22 | <xsl:value-of select="$index-title"/>
|
---|
[a9e89d0] | 23 | </xsl:template>
|
---|
[ded6ddd] | 24 |
|
---|
| 25 | <xsl:template name="index.titlepage">
|
---|
| 26 | <div class="titlepage">
|
---|
[a9e89d0] | 27 | <h1 class="index">
|
---|
| 28 | <xsl:value-of select="$index-title"/>
|
---|
| 29 | </h1>
|
---|
[ded6ddd] | 30 | </div>
|
---|
| 31 | </xsl:template>
|
---|
[0c43171] | 32 |
|
---|
[a9e89d0] | 33 | <!--Divisions-->
|
---|
[0c43171] | 34 | <xsl:template match="indexterm" mode="index-div">
|
---|
| 35 | <xsl:param name="scope" select="."/>
|
---|
| 36 | <xsl:variable name="key" select="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
|
---|
| 37 | <xsl:variable name="divtitle" select="translate($key, &lowercase;, &uppercase;)"/>
|
---|
[a9e89d0] | 38 | <!-- Make sure that we don't generate a div if there are no terms in scope -->
|
---|
[0c43171] | 39 | <xsl:if test="key('letter', $key)[&scope;] [count(.|key('primary', &primary;)[&scope;][1]) = 1]">
|
---|
| 40 | <div class="indexdiv">
|
---|
| 41 | <xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)">
|
---|
| 42 | <h2>
|
---|
[a9e89d0] | 43 | <xsl:choose>
|
---|
| 44 | <xsl:when test="$divtitle = 'A'">
|
---|
| 45 | <xsl:text>Packages</xsl:text>
|
---|
[0c43171] | 46 | </xsl:when>
|
---|
| 47 | <xsl:when test="$divtitle = 'B'">
|
---|
[a9e89d0] | 48 | <xsl:text>Programs</xsl:text>
|
---|
[0c43171] | 49 | </xsl:when>
|
---|
| 50 | <xsl:when test="$divtitle = 'C'">
|
---|
[a9e89d0] | 51 | <xsl:text>Libraries</xsl:text>
|
---|
[0c43171] | 52 | </xsl:when>
|
---|
| 53 | <xsl:when test="$divtitle = 'D'">
|
---|
[a9e89d0] | 54 | <xsl:text>Scripts</xsl:text>
|
---|
[0c43171] | 55 | </xsl:when>
|
---|
| 56 | <xsl:when test="$divtitle = 'E'">
|
---|
| 57 | <xsl:text>Others</xsl:text>
|
---|
| 58 | </xsl:when>
|
---|
| 59 | <xsl:otherwise>
|
---|
[a9e89d0] | 60 | <xsl:value-of select="$divtitle"/>
|
---|
| 61 | </xsl:otherwise>
|
---|
[0c43171] | 62 | </xsl:choose>
|
---|
| 63 | </h2>
|
---|
| 64 | </xsl:if>
|
---|
| 65 | <ul>
|
---|
| 66 | <xsl:apply-templates select="key('letter', $key)[&scope;]
|
---|
[a9e89d0] | 67 | [count(.|key('primary', &primary;)[&scope;][1])=1]" mode="index-primary">
|
---|
[0c43171] | 68 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 69 | <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
---|
| 70 | </xsl:apply-templates>
|
---|
| 71 | </ul>
|
---|
| 72 | </div>
|
---|
| 73 | </xsl:if>
|
---|
| 74 | </xsl:template>
|
---|
| 75 |
|
---|
[a9e89d0] | 76 | <!-- Dropping the separator from here-->
|
---|
[0c43171] | 77 | <xsl:template match="indexterm" mode="reference">
|
---|
| 78 | <xsl:param name="scope" select="."/>
|
---|
| 79 | <xsl:call-template name="reference">
|
---|
| 80 | <xsl:with-param name="zones" select="normalize-space(@zone)"/>
|
---|
| 81 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 82 | </xsl:call-template>
|
---|
[a9e89d0] | 83 | </xsl:template>
|
---|
[0c43171] | 84 |
|
---|
[a9e89d0] | 85 | <!-- Changing the output tags and re-addind the separator-->
|
---|
[0c43171] | 86 | <xsl:template match="indexterm" mode="index-primary">
|
---|
| 87 | <xsl:param name="scope" select="."/>
|
---|
| 88 | <xsl:variable name="key" select="&primary;"/>
|
---|
| 89 | <xsl:variable name="refs" select="key('primary', $key)[&scope;]"/>
|
---|
| 90 | <li>
|
---|
[a9e89d0] | 91 | <strong class="item">
|
---|
| 92 | <xsl:value-of select="primary"/>
|
---|
[0c43171] | 93 | <xsl:text>: </xsl:text>
|
---|
[a9e89d0] | 94 | </strong>
|
---|
[0c43171] | 95 | <xsl:for-each select="$refs[generate-id() = generate-id(key('primary-section',
|
---|
[a9e89d0] | 96 | concat($key, " ", generate-id((ancestor-or-self::book |ancestor-or-self::part
|
---|
[0c43171] | 97 | |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface
|
---|
| 98 | |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3
|
---|
| 99 | |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::index)[last()])))[&scope;][1])]">
|
---|
| 100 | <xsl:apply-templates select="." mode="reference">
|
---|
| 101 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 102 | </xsl:apply-templates>
|
---|
| 103 | </xsl:for-each>
|
---|
[a9e89d0] | 104 | <xsl:if test="$refs/secondary">
|
---|
[0c43171] | 105 | <ul>
|
---|
| 106 | <xsl:apply-templates select="$refs[secondary and count(.|key('secondary',
|
---|
[a9e89d0] | 107 | concat($key, " ", normalize-space(concat(secondary/@sortas,
|
---|
[0c43171] | 108 | secondary[not(@sortas)]))))[&scope;][1]) = 1]" mode="index-secondary">
|
---|
| 109 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 110 | <xsl:sort select="translate(normalize-space(concat(secondary/@sortas,
|
---|
[a9e89d0] | 111 | secondary[not(@sortas)])), &lowercase;, &uppercase;)"/>
|
---|
[0c43171] | 112 | </xsl:apply-templates>
|
---|
[a9e89d0] | 113 | </ul>
|
---|
| 114 | </xsl:if>
|
---|
[0c43171] | 115 | </li>
|
---|
| 116 | </xsl:template>
|
---|
[ded6ddd] | 117 |
|
---|
[0c43171] | 118 | <xsl:template match="indexterm" mode="index-secondary">
|
---|
| 119 | <xsl:param name="scope" select="."/>
|
---|
| 120 | <xsl:variable name="key" select="concat(&primary;, " ",
|
---|
[a9e89d0] | 121 | normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])))"/>
|
---|
[0c43171] | 122 | <xsl:variable name="refs" select="key('secondary', $key)[&scope;]"/>
|
---|
| 123 | <li>
|
---|
[a9e89d0] | 124 | <strong class="secitem">
|
---|
| 125 | <xsl:value-of select="secondary"/>
|
---|
[0c43171] | 126 | <xsl:text>: </xsl:text>
|
---|
[a9e89d0] | 127 | </strong>
|
---|
[0c43171] | 128 | <xsl:for-each select="$refs[generate-id() = generate-id(key('secondary-section',
|
---|
[a9e89d0] | 129 | concat($key, " ", generate-id((ancestor-or-self::book |ancestor-or-self::part
|
---|
[0c43171] | 130 | |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface
|
---|
| 131 | |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3
|
---|
| 132 | |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::index)[last()])))[&scope;][1])]">
|
---|
| 133 | <xsl:apply-templates select="." mode="reference">
|
---|
| 134 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 135 | </xsl:apply-templates>
|
---|
| 136 | </xsl:for-each>
|
---|
| 137 | </li>
|
---|
| 138 | </xsl:template>
|
---|
| 139 |
|
---|
| 140 | <!--Links (This template also fix a bug in the original code)-->
|
---|
| 141 | <xsl:template name="reference">
|
---|
| 142 | <xsl:param name="scope" select="."/>
|
---|
| 143 | <xsl:param name="zones"/>
|
---|
| 144 | <xsl:choose>
|
---|
| 145 | <xsl:when test="contains($zones, ' ')">
|
---|
| 146 | <xsl:variable name="zone" select="substring-before($zones, ' ')"/>
|
---|
| 147 | <xsl:variable name="zone2" select="substring-after($zones, ' ')"/>
|
---|
| 148 | <xsl:variable name="target" select="key('sections', $zone)[&scope;]"/>
|
---|
| 149 | <xsl:variable name="target2" select="key('sections', $zone2)[&scope;]"/>
|
---|
| 150 | <a>
|
---|
| 151 | <xsl:attribute name="href">
|
---|
| 152 | <xsl:call-template name="href.target.uri">
|
---|
| 153 | <xsl:with-param name="object" select="$target[1]"/>
|
---|
| 154 | </xsl:call-template>
|
---|
| 155 | </xsl:attribute>
|
---|
| 156 | <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
|
---|
| 157 | </a>
|
---|
| 158 | <xsl:text> -- </xsl:text>
|
---|
| 159 | <a>
|
---|
| 160 | <xsl:attribute name="href">
|
---|
| 161 | <xsl:call-template name="href.target.uri">
|
---|
| 162 | <xsl:with-param name="object" select="$target2[1]"/>
|
---|
| 163 | </xsl:call-template>
|
---|
| 164 | </xsl:attribute>
|
---|
| 165 | <xsl:text>description</xsl:text>
|
---|
| 166 | </a>
|
---|
| 167 | </xsl:when>
|
---|
| 168 | <xsl:otherwise>
|
---|
| 169 | <xsl:variable name="zone" select="$zones"/>
|
---|
| 170 | <xsl:variable name="target" select="key('sections', $zone)[&scope;]"/>
|
---|
| 171 | <a>
|
---|
| 172 | <xsl:attribute name="href">
|
---|
| 173 | <xsl:call-template name="href.target.uri">
|
---|
| 174 | <xsl:with-param name="object" select="$target[1]"/>
|
---|
| 175 | </xsl:call-template>
|
---|
| 176 | </xsl:attribute>
|
---|
| 177 | <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
|
---|
| 178 | </a>
|
---|
| 179 | </xsl:otherwise>
|
---|
| 180 | </xsl:choose>
|
---|
| 181 | </xsl:template>
|
---|
[ded6ddd] | 182 |
|
---|
| 183 | <!-- Dropping unneeded anchors -->
|
---|
| 184 | <xsl:template match="indexterm"/>
|
---|
[0c43171] | 185 |
|
---|
| 186 | </xsl:stylesheet>
|
---|