source: stylesheets/xhtml/lfs-index.xsl@ 98b068f

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 6.0 6.1 6.2 6.2.0 6.2.0-rc1 6.2.0-rc2 6.3 6.3-rc1 6.3-rc2 6.3-rc3 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb v5_1 v5_1-pre1 xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 98b068f was 5d4975d, checked in by Larry Lawrence <larry@…>, 20 years ago

updated stylesheets to 0.9

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@2121 af4574ff-66df-0310-9fd7-8a98e5e911e0

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