[d466027] | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
[65b2904] | 2 |
|
---|
| 3 | <!DOCTYPE xsl:stylesheet [
|
---|
[d466027] | 4 | <!ENTITY lowercase "'AaÀàÁáÂâÃãÄäÅåĀāĂ㥹ǍǎǞǟǠǡǺǻȀȁȂȃȦȧḀḁẚẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặBbƀƁɓƂƃḂḃḄḅḆḇCcÇçĆćĈĉĊċČčƇƈɕḈḉDdĎďĐđƊɗƋƌDžDzȡɖḊḋḌḍḎḏḐḑḒḓEeÈèÉéÊêËëĒēĔĕĖėĘęĚěȄȅȆȇȨȩḔḕḖḗḘḙḚḛḜḝẸẹẺẻẼẽẾếỀềỂểỄễỆệFfƑƒḞḟGgĜĝĞğĠġĢģƓɠǤǥǦǧǴǵḠḡHhĤĥĦħȞȟɦḢḣḤḥḦḧḨḩḪḫẖIiÌìÍíÎîÏïĨĩĪīĬĭĮįİƗɨǏǐȈȉȊȋḬḭḮḯỈỉỊịJjĴĵǰʝKkĶķƘƙǨǩḰḱḲḳḴḵLlĹĺĻļĽľĿŀŁłƚLjȴɫɬɭḶḷḸḹḺḻḼḽMmɱḾḿṀṁṂṃNnÑñŃńŅņŇňƝɲƞȠNjǸǹȵɳṄṅṆṇṈṉṊṋOoÒòÓóÔôÕõÖöØøŌōŎŏŐőƟƠơǑǒǪǫǬǭǾǿȌȍȎȏȪȫȬȭȮȯȰȱṌṍṎṏṐṑṒṓỌọỎỏỐốỒồỔổỖỗỘộỚớỜờỞởỠỡỢợPpƤƥṔṕṖṗQqʠRrŔŕŖŗŘřȐȑȒȓɼɽɾṘṙṚṛṜṝṞṟSsŚśŜŝŞşŠšȘșʂṠṡṢṣṤṥṦṧṨṩTtŢţŤťŦŧƫƬƭƮʈȚțȶṪṫṬṭṮṯṰṱẗUuÙùÚúÛûÜüŨũŪūŬŭŮůŰűŲųƯưǓǔǕǖǗǘǙǚǛǜȔȕȖȗṲṳṴṵṶṷṸṹṺṻỤụỦủỨứỪừỬửỮữỰựVvƲʋṼṽṾṿWwŴŵẀẁẂẃẄẅẆẇẈẉẘXxẊẋẌẍYyÝýÿŸŶŷƳƴȲȳẎẏẙỲỳỴỵỶỷỸỹZzŹźŻżŽžƵƶȤȥʐʑẐẑẒẓẔẕẕ'">
|
---|
[65b2904] | 5 | <!ENTITY uppercase "'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEFFFFFFGGGGGGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIJJJJJJKKKKKKKKKKKKKKLLLLLLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOPPPPPPPPQQQRRRRRRRRRRRRRRRRRRRRRRRSSSSSSSSSSSSSSSSSSSSSSSTTTTTTTTTTTTTTTTTTTTTTTTTUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUVVVVVVVVWWWWWWWWWWWWWWWXXXXXXYYYYYYYYYYYYYYYYYYYYYYYZZZZZZZZZZZZZZZZZZZZZ'">
|
---|
| 6 | <!ENTITY primary 'normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = ""]))'>
|
---|
| 7 | <!ENTITY secondary 'normalize-space(concat(secondary/@sortas, secondary[not(@sortas) or @sortas = ""]))'>
|
---|
| 8 | <!ENTITY scope "count(ancestor::node()|$scope) = count(ancestor::node())">
|
---|
| 9 | <!ENTITY section "(ancestor-or-self::set |ancestor-or-self::book |ancestor-or-self::part |ancestor-or-self::reference |ancestor-or-self::partintro |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface |ancestor-or-self::article |ancestor-or-self::section |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3 |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::refentry |ancestor-or-self::refsect1 |ancestor-or-self::refsect2 |ancestor-or-self::refsect3 |ancestor-or-self::simplesect |ancestor-or-self::bibliography |ancestor-or-self::glossary |ancestor-or-self::index |ancestor-or-self::webpage)[last()]">
|
---|
| 10 | <!ENTITY section.id "generate-id(§ion;)">
|
---|
| 11 | <!ENTITY sep '" "'>
|
---|
| 12 | ]>
|
---|
| 13 |
|
---|
| 14 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
| 15 | xmlns="http://www.w3.org/1999/xhtml"
|
---|
| 16 | version="1.0">
|
---|
| 17 |
|
---|
[c40c526] | 18 | <!-- Change the file name of the index page from the default ix01.html.
|
---|
| 19 | There is no upstream template with match="index", only a global
|
---|
| 20 | match="*", thus the following is enough to override the index
|
---|
| 21 | filename. -->
|
---|
[65b2904] | 22 |
|
---|
| 23 | <xsl:template match="index" mode="recursive-chunk-filename">
|
---|
| 24 | <xsl:text>longindex.html</xsl:text>
|
---|
| 25 | </xsl:template>
|
---|
| 26 |
|
---|
[c40c526] | 27 | <!-- The original template in {docbook-xsl}/xhtml/autoidx.xsl has
|
---|
| 28 | a bug (https://github.com/docbook/xslt10-stylesheets/issues/239)
|
---|
| 29 | that generates a <div> with a wrong xmlns:xlink attribute. So copy it
|
---|
| 30 | here where the bug does not occur, (and simplify it a lot).-->
|
---|
| 31 |
|
---|
| 32 | <xsl:template name="generate-basic-index">
|
---|
| 33 | <xsl:param name="scope" select="NOTANODE"/>
|
---|
| 34 |
|
---|
| 35 | <xsl:variable name="terms" select="//indexterm
|
---|
| 36 | [count(.|key('letter',
|
---|
| 37 | translate(substring(&primary;, 1, 1),
|
---|
| 38 | &lowercase;,
|
---|
| 39 | &uppercase;
|
---|
| 40 | )
|
---|
| 41 | ) [&scope;][1]) = 1]"/>
|
---|
| 42 | <div class="index">
|
---|
| 43 | <xsl:apply-templates select="$terms" mode="index-div-basic">
|
---|
| 44 | <xsl:with-param name="position" select="position()"/>
|
---|
| 45 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 46 | <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
---|
| 47 | </xsl:apply-templates>
|
---|
| 48 | </div>
|
---|
| 49 | </xsl:template>
|
---|
| 50 |
|
---|
| 51 | <!-- Divisions:
|
---|
| 52 | Override the default division titles, translating them from the default
|
---|
| 53 | 'A', 'B', etc. to 'Packages', 'Programs', etc.
|
---|
| 54 | Add gentext support to division titles.
|
---|
| 55 | Use h2 for division titles instead of the default h3.
|
---|
| 56 | Change main listings from dl to ul format.
|
---|
| 57 | The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
|
---|
[65b2904] | 58 |
|
---|
| 59 | <xsl:template match="indexterm" mode="index-div-basic">
|
---|
| 60 | <xsl:param name="scope" select="."/>
|
---|
| 61 | <xsl:variable name="key" select="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
|
---|
| 62 | <xsl:variable name="divtitle" select="translate($key, &lowercase;, &uppercase;)"/>
|
---|
[c40c526] | 63 | <!-- Make sure that we don't generate a div if there are no terms in scope
|
---|
| 64 | -->
|
---|
[65b2904] | 65 | <xsl:if test="key('letter', $key)[&scope;] [count(.|key('primary', &primary;)[&scope;][1]) = 1]">
|
---|
| 66 | <xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)">
|
---|
| 67 | <h2>
|
---|
| 68 | <xsl:choose>
|
---|
| 69 | <xsl:when test="$divtitle = 'A'">
|
---|
| 70 | <a id="package-index" name="package-index"/>
|
---|
| 71 | <xsl:call-template name="gentext">
|
---|
| 72 | <xsl:with-param name="key">Packages</xsl:with-param>
|
---|
| 73 | </xsl:call-template>
|
---|
| 74 | </xsl:when>
|
---|
| 75 | <xsl:when test="$divtitle = 'B'">
|
---|
| 76 | <a id="program-index" name="program-index"/>
|
---|
| 77 | <xsl:call-template name="gentext">
|
---|
| 78 | <xsl:with-param name="key">Programs</xsl:with-param>
|
---|
| 79 | </xsl:call-template>
|
---|
| 80 | </xsl:when>
|
---|
| 81 | <xsl:when test="$divtitle = 'C'">
|
---|
| 82 | <a id="library-index" name="library-index"/>
|
---|
| 83 | <xsl:call-template name="gentext">
|
---|
| 84 | <xsl:with-param name="key">Libraries</xsl:with-param>
|
---|
| 85 | </xsl:call-template>
|
---|
| 86 | </xsl:when>
|
---|
| 87 | <xsl:when test="$divtitle = 'D'">
|
---|
| 88 | <xsl:choose>
|
---|
| 89 | <xsl:when test="$book-type = 'blfs'">
|
---|
| 90 | <a id="kernel-config-index" name="kernel-config-index"/>
|
---|
| 91 | <xsl:call-template name="gentext">
|
---|
| 92 | <xsl:with-param name="key">Kernel Configuration</xsl:with-param>
|
---|
| 93 | </xsl:call-template>
|
---|
| 94 | </xsl:when>
|
---|
| 95 | <xsl:otherwise>
|
---|
| 96 | <a id="scripts-index" name="scripts-index"/>
|
---|
| 97 | <xsl:call-template name="gentext">
|
---|
| 98 | <xsl:with-param name="key">Scripts</xsl:with-param>
|
---|
| 99 | </xsl:call-template>
|
---|
| 100 | </xsl:otherwise>
|
---|
| 101 | </xsl:choose>
|
---|
| 102 | </xsl:when>
|
---|
| 103 | <xsl:when test="$divtitle = 'E'">
|
---|
| 104 | <xsl:choose>
|
---|
| 105 | <xsl:when test="$book-type = 'blfs'">
|
---|
| 106 | <a id="config-file-index" name="config-file-index"/>
|
---|
| 107 | <xsl:call-template name="gentext">
|
---|
| 108 | <xsl:with-param name="key">Configuration Files</xsl:with-param>
|
---|
| 109 | </xsl:call-template>
|
---|
| 110 | </xsl:when>
|
---|
| 111 | <xsl:otherwise>
|
---|
| 112 | <a id="other-index" name="other-index"/>
|
---|
| 113 | <xsl:call-template name="gentext">
|
---|
| 114 | <xsl:with-param name="key">Others</xsl:with-param>
|
---|
| 115 | </xsl:call-template>
|
---|
| 116 | </xsl:otherwise>
|
---|
| 117 | </xsl:choose>
|
---|
| 118 | </xsl:when>
|
---|
| 119 | <xsl:when test="$divtitle = 'F'">
|
---|
| 120 | <a id="bootscript-index" name="bootscript-index"/>
|
---|
| 121 | <xsl:call-template name="gentext">
|
---|
| 122 | <xsl:with-param name="key">Bootscripts</xsl:with-param>
|
---|
| 123 | </xsl:call-template>
|
---|
| 124 | </xsl:when>
|
---|
| 125 | <xsl:when test="$divtitle = 'G'">
|
---|
| 126 | <a id="other-index" name="other-index"/>
|
---|
| 127 | <xsl:call-template name="gentext">
|
---|
| 128 | <xsl:with-param name="key">Others</xsl:with-param>
|
---|
| 129 | </xsl:call-template>
|
---|
| 130 | </xsl:when>
|
---|
| 131 | <xsl:otherwise>
|
---|
| 132 | <xsl:value-of select="$divtitle"/>
|
---|
| 133 | </xsl:otherwise>
|
---|
| 134 | </xsl:choose>
|
---|
| 135 | </h2>
|
---|
| 136 | </xsl:if>
|
---|
| 137 | <ul>
|
---|
[869909a] | 138 | <xsl:apply-templates select="key('letter', $key)[count(ancestor::node()|$scope) = count(ancestor::node())][count(.|key('primary', normalize-space(concat(primary/@sortas, " ", primary)))[count(ancestor::node()|$scope) = count(ancestor::node())][1])=1]" mode="index-primary">
|
---|
| 139 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 140 | <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
---|
| 141 | </xsl:apply-templates>
|
---|
[65b2904] | 142 | </ul>
|
---|
| 143 | </xsl:if>
|
---|
| 144 | </xsl:template>
|
---|
| 145 |
|
---|
[c40c526] | 146 | <!-- Primary items:
|
---|
| 147 | Place term and separator into strong tags.
|
---|
| 148 | Place target links into a div.
|
---|
| 149 | Change main listings from dl to ul format.
|
---|
| 150 | Removed code for unused see and sealso children.
|
---|
| 151 | The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
|
---|
[65b2904] | 152 | <xsl:template match="indexterm" mode="index-primary">
|
---|
| 153 | <xsl:param name="scope" select="."/>
|
---|
[869909a] | 154 | <xsl:variable name="key" select="normalize-space(concat(primary/@sortas, " ", primary))"/>
|
---|
| 155 | <xsl:variable name="refs" select="key('primary', $key)[count(ancestor::node()|$scope) = count(ancestor::node())]"/>
|
---|
[65b2904] | 156 | <li>
|
---|
| 157 | <strong class="item">
|
---|
| 158 | <xsl:value-of select="primary"/>
|
---|
| 159 | <xsl:text>: </xsl:text>
|
---|
| 160 | </strong>
|
---|
| 161 | <span class='indexref'>
|
---|
| 162 | <xsl:for-each select="$refs[generate-id() = generate-id(key('primary-section',concat($key, &sep;, §ion.id;))[&scope;][1])]">
|
---|
[c40c526] | 163 | <!--<xsl:for-each select="$refs[not(see) and not(secondary)][count(ancestor::node()|$scope) = count(ancestor::node()) = 0]">-->
|
---|
[65b2904] | 164 | <xsl:apply-templates select="." mode="reference">
|
---|
| 165 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 166 | </xsl:apply-templates>
|
---|
| 167 | </xsl:for-each>
|
---|
| 168 | </span>
|
---|
| 169 | <xsl:if test="$refs/secondary">
|
---|
| 170 | <ul>
|
---|
[869909a] | 171 | <xsl:apply-templates select="$refs[secondary and count(.|key('secondary', concat($key, " ", normalize-space(concat(secondary/@sortas, " ", secondary))))[count(ancestor::node()|$scope) = count(ancestor::node()) ][1]) = 1]" mode="index-secondary">
|
---|
[65b2904] | 172 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 173 | <xsl:sort select="translate(&secondary;, &lowercase;, &uppercase;)"/>
|
---|
| 174 | </xsl:apply-templates>
|
---|
| 175 | </ul>
|
---|
| 176 | </xsl:if>
|
---|
| 177 | </li>
|
---|
| 178 | </xsl:template>
|
---|
| 179 |
|
---|
[c40c526] | 180 | <!-- Secondary items:
|
---|
| 181 | Place term and separator into strong tags.
|
---|
| 182 | Place target links into a div.
|
---|
| 183 | Change main listings from dl to ul format.
|
---|
| 184 | Removed code for unused tertiary, see and sealso children.
|
---|
| 185 | The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
|
---|
[65b2904] | 186 | <xsl:template match="indexterm" mode="index-secondary">
|
---|
| 187 | <xsl:param name="scope" select="."/>
|
---|
[869909a] | 188 | <xsl:variable name="key" select="concat(normalize-space(concat(primary/@sortas, " ", primary)), " ", normalize-space(concat(secondary/@sortas, " ", secondary)))"/>
|
---|
| 189 | <xsl:variable name="refs" select="key('secondary', $key)[count(ancestor::node()|$scope) = count(ancestor::node())]"/>
|
---|
[65b2904] | 190 | <li>
|
---|
| 191 | <strong class="secitem">
|
---|
| 192 | <xsl:value-of select="secondary"/>
|
---|
| 193 | <xsl:text>: </xsl:text>
|
---|
| 194 | </strong>
|
---|
| 195 | <span class='indexref'>
|
---|
| 196 | <xsl:for-each select="$refs[generate-id() = generate-id(key('secondary-section', concat($key, &sep;, §ion.id;))[&scope;][1])]">
|
---|
| 197 | <xsl:apply-templates select="." mode="reference">
|
---|
| 198 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 199 | </xsl:apply-templates>
|
---|
| 200 | </xsl:for-each>
|
---|
| 201 | </span>
|
---|
| 202 | </li>
|
---|
| 203 | </xsl:template>
|
---|
| 204 |
|
---|
[869909a] | 205 | <!-- Drop $term.separator and $number.separator from here as customized ones
|
---|
| 206 | are added in the output flow.
|
---|
| 207 | As all the indexterms in the book have @zone attributes, removed a lot of
|
---|
| 208 | unused code.
|
---|
| 209 | The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
|
---|
| 210 | <xsl:template match="indexterm" mode="reference">
|
---|
| 211 | <xsl:param name="scope" select="."/>
|
---|
| 212 | <xsl:call-template name="reference">
|
---|
| 213 | <xsl:with-param name="zones" select="normalize-space(@zone)"/>
|
---|
| 214 | <xsl:with-param name="scope" select="$scope"/>
|
---|
| 215 | </xsl:call-template>
|
---|
| 216 | </xsl:template>
|
---|
| 217 |
|
---|
| 218 | <!-- The target links:
|
---|
| 219 | Changed link separator
|
---|
| 220 | On the second @zone link, we use a fixed string for the text with gentext
|
---|
| 221 | support.
|
---|
| 222 | Assume that there are no more than 2 @zone in a indexterm.
|
---|
| 223 | Use href.target.uri named template to resolve the links. It is faster
|
---|
| 224 | than the default href.target named template.
|
---|
| 225 | The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
|
---|
[65b2904] | 226 | <xsl:template name="reference">
|
---|
| 227 | <xsl:param name="scope" select="."/>
|
---|
| 228 | <xsl:param name="zones"/>
|
---|
| 229 | <xsl:choose>
|
---|
| 230 | <xsl:when test="contains($zones, ' ')">
|
---|
| 231 | <xsl:variable name="zone" select="substring-before($zones, ' ')"/>
|
---|
| 232 | <xsl:variable name="zone2" select="substring-after($zones, ' ')"/>
|
---|
| 233 | <xsl:variable name="target" select="key('sections', $zone)[&scope;]"/>
|
---|
| 234 | <xsl:variable name="target2" select="key('sections', $zone2)[&scope;]"/>
|
---|
| 235 | <a>
|
---|
| 236 | <xsl:attribute name="href">
|
---|
| 237 | <xsl:call-template name="href.target.uri">
|
---|
| 238 | <xsl:with-param name="object" select="$target[1]"/>
|
---|
| 239 | </xsl:call-template>
|
---|
| 240 | </xsl:attribute>
|
---|
| 241 | <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
|
---|
| 242 | </a>
|
---|
| 243 | <xsl:text> -- </xsl:text>
|
---|
| 244 | <a>
|
---|
| 245 | <xsl:attribute name="href">
|
---|
| 246 | <xsl:call-template name="href.target.uri">
|
---|
| 247 | <xsl:with-param name="object" select="$target2[1]"/>
|
---|
| 248 | </xsl:call-template>
|
---|
| 249 | </xsl:attribute>
|
---|
| 250 | <xsl:call-template name="gentext">
|
---|
| 251 | <xsl:with-param name="key">description</xsl:with-param>
|
---|
| 252 | </xsl:call-template>
|
---|
| 253 | </a>
|
---|
| 254 | <br/>
|
---|
| 255 | </xsl:when>
|
---|
| 256 | <xsl:otherwise>
|
---|
| 257 | <xsl:variable name="zone" select="$zones"/>
|
---|
| 258 | <xsl:variable name="target" select="key('sections', $zone)[&scope;]"/>
|
---|
| 259 | <a>
|
---|
| 260 | <xsl:attribute name="href">
|
---|
| 261 | <xsl:call-template name="href.target.uri">
|
---|
| 262 | <xsl:with-param name="object" select="$target[1]"/>
|
---|
| 263 | </xsl:call-template>
|
---|
| 264 | </xsl:attribute>
|
---|
| 265 | <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
|
---|
| 266 | </a>
|
---|
[fa068b9] | 267 | <br/>
|
---|
[65b2904] | 268 | </xsl:otherwise>
|
---|
| 269 | </xsl:choose>
|
---|
| 270 | </xsl:template>
|
---|
| 271 |
|
---|
| 272 | </xsl:stylesheet>
|
---|