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())'
>
9 <!-- Version 0.8.0 - Manuel Canales Esparcia <macana@lfs-es.org> -->
11 <xsl:stylesheet xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
12 xmlns=
"http://www.w3.org/1999/xhtml"
18 <xsl:template match=
"index" mode=
"recursive-chunk-filename">
19 <xsl:text>longindex.html
</xsl:text>
23 <xsl:template match=
"index" mode=
"title.markup">
24 <xsl:param name=
"allow-anchors" select=
"0"/>
25 <xsl:text>Index of packages and important installed files
</xsl:text>
29 <xsl:template match=
"indexterm" mode=
"index-div">
30 <xsl:param name=
"scope" select=
"."/>
31 <xsl:variable name=
"key" select=
"translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
32 <xsl:variable name=
"divtitle" select=
"translate($key, &lowercase;, &uppercase;)"/>
33 <!-- Make sure that we don't generate a div if there are no terms in scope -->
34 <xsl:if test=
"key('letter', $key)[&scope;] [count(.|key('primary', &primary;)[&scope;][1]) = 1]">
35 <div class=
"indexdiv">
36 <xsl:if test=
"contains(concat(&lowercase;, &uppercase;), $key)">
39 <xsl:when test=
"$divtitle = 'A'">
40 <xsl:text>Packages
</xsl:text>
42 <xsl:when test=
"$divtitle = 'B'">
43 <xsl:text>Programs
</xsl:text>
45 <xsl:when test=
"$divtitle = 'C'">
46 <xsl:text>Libraries
</xsl:text>
48 <xsl:when test=
"$divtitle = 'D'">
49 <xsl:text>Scripts
</xsl:text>
51 <xsl:when test=
"$divtitle = 'E'">
52 <xsl:text>Others
</xsl:text>
55 <xsl:value-of select=
"$divtitle"/>
61 <xsl:apply-templates select=
"key('letter', $key)[&scope;]
62 [count(.|key('primary', &primary;)[&scope;][1])=1]" mode=
"index-primary">
63 <xsl:with-param name=
"scope" select=
"$scope"/>
64 <xsl:sort select=
"translate(&primary;, &lowercase;, &uppercase;)"/>
65 </xsl:apply-templates>
71 <!-- Dropping the separator from here-->
72 <xsl:template match=
"indexterm" mode=
"reference">
73 <xsl:param name=
"scope" select=
"."/>
74 <xsl:call-template name=
"reference">
75 <xsl:with-param name=
"zones" select=
"normalize-space(@zone)"/>
76 <xsl:with-param name=
"scope" select=
"$scope"/>
80 <!-- Changing the output tags and re-addind the separator-->
81 <xsl:template match=
"indexterm" mode=
"index-primary">
82 <xsl:param name=
"scope" select=
"."/>
83 <xsl:variable name=
"key" select=
"&primary;"/>
84 <xsl:variable name=
"refs" select=
"key('primary', $key)[&scope;]"/>
87 <xsl:value-of select=
"primary"/>
88 <xsl:text>:
</xsl:text>
90 <xsl:for-each select=
"$refs[generate-id() = generate-id(key('primary-section',
91 concat($key, " ", generate-id((ancestor-or-self::book |ancestor-or-self::part
92 |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface
93 |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3
94 |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::index)[last()])))[&scope;][1])]">
95 <xsl:apply-templates select=
"." mode=
"reference">
96 <xsl:with-param name=
"scope" select=
"$scope"/>
97 </xsl:apply-templates>
99 <xsl:if test=
"$refs/secondary">
101 <xsl:apply-templates select=
"$refs[secondary and count(.|key('secondary',
102 concat($key, " ", normalize-space(concat(secondary/@sortas,
103 secondary[not(@sortas)]))))[&scope;][1]) = 1]" mode=
"index-secondary">
104 <xsl:with-param name=
"scope" select=
"$scope"/>
105 <xsl:sort select=
"translate(normalize-space(concat(secondary/@sortas,
106 secondary[not(@sortas)])), &lowercase;, &uppercase;)"/>
107 </xsl:apply-templates>
112 <xsl:template match=
"indexterm" mode=
"index-secondary">
113 <xsl:param name=
"scope" select=
"."/>
114 <xsl:variable name=
"key" select=
"concat(&primary;, " ",
115 normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])))"/>
116 <xsl:variable name=
"refs" select=
"key('secondary', $key)[&scope;]"/>
118 <strong class=
"secitem">
119 <xsl:value-of select=
"secondary"/>
120 <xsl:text>:
</xsl:text>
122 <xsl:for-each select=
"$refs[generate-id() = generate-id(key('secondary-section',
123 concat($key, " ", generate-id((ancestor-or-self::book |ancestor-or-self::part
124 |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface
125 |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3
126 |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::index)[last()])))[&scope;][1])]">
127 <xsl:apply-templates select=
"." mode=
"reference">
128 <xsl:with-param name=
"scope" select=
"$scope"/>
129 </xsl:apply-templates>
134 <!--Links (This template also fix a bug in the original code)-->
135 <xsl:template name=
"reference">
136 <xsl:param name=
"scope" select=
"."/>
137 <xsl:param name=
"zones"/>
139 <xsl:when test=
"contains($zones, ' ')">
140 <xsl:variable name=
"zone" select=
"substring-before($zones, ' ')"/>
141 <xsl:variable name=
"zone2" select=
"substring-after($zones, ' ')"/>
142 <xsl:variable name=
"target" select=
"key('sections', $zone)[&scope;]"/>
143 <xsl:variable name=
"target2" select=
"key('sections', $zone2)[&scope;]"/>
145 <xsl:attribute name=
"href">
146 <xsl:call-template name=
"href.target.uri">
147 <xsl:with-param name=
"object" select=
"$target[1]"/>
150 <xsl:apply-templates select=
"$target[1]" mode=
"index-title-content"/>
152 <xsl:text> --
</xsl:text>
154 <xsl:attribute name=
"href">
155 <xsl:call-template name=
"href.target.uri">
156 <xsl:with-param name=
"object" select=
"$target2[1]"/>
159 <xsl:text>description
</xsl:text>
163 <xsl:variable name=
"zone" select=
"$zones"/>
164 <xsl:variable name=
"target" select=
"key('sections', $zone)[&scope;]"/>
166 <xsl:attribute name=
"href">
167 <xsl:call-template name=
"href.target.uri">
168 <xsl:with-param name=
"object" select=
"$target[1]"/>
171 <xsl:apply-templates select=
"$target[1]" mode=
"index-title-content"/>