source: stylesheets/xhtml/lfs-index.xsl@ a9e89d0

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 6.0 6.1 6.1.1 6.3 6.4 6.5 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since a9e89d0 was a9e89d0, checked in by Manuel Canales Esparcia <manuel@…>, 20 years ago

HEAD: StyleSheets - unified the identation to use spaces.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@3663 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • 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<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-->
19 <xsl:param name="index-title">Index of packages and important installed files</xsl:param>
20
21 <xsl:template match="index" mode="title.markup">
22 <xsl:value-of select="$index-title"/>
23 </xsl:template>
24
25 <xsl:template name="index.titlepage">
26 <div class="titlepage">
27 <h1 class="index">
28 <xsl:value-of select="$index-title"/>
29 </h1>
30 </div>
31 </xsl:template>
32
33 <!--Divisions-->
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;)"/>
38 <!-- Make sure that we don't generate a div if there are no terms in scope -->
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>
43 <xsl:choose>
44 <xsl:when test="$divtitle = 'A'">
45 <xsl:text>Packages</xsl:text>
46 </xsl:when>
47 <xsl:when test="$divtitle = 'B'">
48 <xsl:text>Programs</xsl:text>
49 </xsl:when>
50 <xsl:when test="$divtitle = 'C'">
51 <xsl:text>Libraries</xsl:text>
52 </xsl:when>
53 <xsl:when test="$divtitle = 'D'">
54 <xsl:text>Scripts</xsl:text>
55 </xsl:when>
56 <xsl:when test="$divtitle = 'E'">
57 <xsl:text>Others</xsl:text>
58 </xsl:when>
59 <xsl:otherwise>
60 <xsl:value-of select="$divtitle"/>
61 </xsl:otherwise>
62 </xsl:choose>
63 </h2>
64 </xsl:if>
65 <ul>
66 <xsl:apply-templates select="key('letter', $key)[&scope;]
67 [count(.|key('primary', &primary;)[&scope;][1])=1]" mode="index-primary">
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
76 <!-- Dropping the separator from here-->
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>
83 </xsl:template>
84
85 <!-- Changing the output tags and re-addind the separator-->
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>
91 <strong class="item">
92 <xsl:value-of select="primary"/>
93 <xsl:text>: </xsl:text>
94 </strong>
95 <xsl:for-each select="$refs[generate-id() = generate-id(key('primary-section',
96 concat($key, &#34; &#34;, generate-id((ancestor-or-self::book |ancestor-or-self::part
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>
104 <xsl:if test="$refs/secondary">
105 <ul>
106 <xsl:apply-templates select="$refs[secondary and count(.|key('secondary',
107 concat($key, &#34; &#34;, normalize-space(concat(secondary/@sortas,
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,
111 secondary[not(@sortas)])), &lowercase;, &uppercase;)"/>
112 </xsl:apply-templates>
113 </ul>
114 </xsl:if>
115 </li>
116 </xsl:template>
117
118 <xsl:template match="indexterm" mode="index-secondary">
119 <xsl:param name="scope" select="."/>
120 <xsl:variable name="key" select="concat(&primary;, &#34; &#34;,
121 normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])))"/>
122 <xsl:variable name="refs" select="key('secondary', $key)[&scope;]"/>
123 <li>
124 <strong class="secitem">
125 <xsl:value-of select="secondary"/>
126 <xsl:text>: </xsl:text>
127 </strong>
128 <xsl:for-each select="$refs[generate-id() = generate-id(key('secondary-section',
129 concat($key, &#34; &#34;, generate-id((ancestor-or-self::book |ancestor-or-self::part
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>
182
183 <!-- Dropping unneeded anchors -->
184 <xsl:template match="indexterm"/>
185
186</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.