source: stylesheets/xhtml/blfs-index.xsl@ 5778f24

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 5778f24 was ae8a3e4, checked in by Larry Lawrence <larry@…>, 20 years ago

updated stylesheets to match LFS

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

  • Property mode set to 100644
File size: 7.4 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.8.0 - 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 <!--Index Stuff-->
16
17 <!--Filename-->
18 <xsl:template match="index" mode="recursive-chunk-filename">
19 <xsl:text>longindex.html</xsl:text>
20 </xsl:template>
21
22 <!--Title-->
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>
26 </xsl:template>
27
28 <!--Divisions-->
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)">
37 <h2>
38 <xsl:choose>
39 <xsl:when test="$divtitle = 'A'">
40 <xsl:text>Packages</xsl:text>
41 </xsl:when>
42 <xsl:when test="$divtitle = 'B'">
43 <xsl:text>Programs</xsl:text>
44 </xsl:when>
45 <xsl:when test="$divtitle = 'C'">
46 <xsl:text>Libraries</xsl:text>
47 </xsl:when>
48 <xsl:when test="$divtitle = 'D'">
49 <xsl:text>Scripts</xsl:text>
50 </xsl:when>
51 <xsl:when test="$divtitle = 'E'">
52 <xsl:text>Others</xsl:text>
53 </xsl:when>
54 <xsl:otherwise>
55 <xsl:value-of select="$divtitle"/>
56 </xsl:otherwise>
57 </xsl:choose>
58 </h2>
59 </xsl:if>
60 <ul>
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>
66 </ul>
67 </div>
68 </xsl:if>
69 </xsl:template>
70
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"/>
77 </xsl:call-template>
78 </xsl:template>
79
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;]"/>
85 <li>
86 <strong class="item">
87 <xsl:value-of select="primary"/>
88 <xsl:text>: </xsl:text>
89 </strong>
90 <xsl:for-each select="$refs[generate-id() = generate-id(key('primary-section',
91 concat($key, &#34; &#34;, 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>
98 </xsl:for-each>
99 <xsl:if test="$refs/secondary">
100 <ul>
101 <xsl:apply-templates select="$refs[secondary and count(.|key('secondary',
102 concat($key, &#34; &#34;, 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>
108 </ul>
109 </xsl:if>
110 </li>
111 </xsl:template>
112 <xsl:template match="indexterm" mode="index-secondary">
113 <xsl:param name="scope" select="."/>
114 <xsl:variable name="key" select="concat(&primary;, &#34; &#34;,
115 normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])))"/>
116 <xsl:variable name="refs" select="key('secondary', $key)[&scope;]"/>
117 <li>
118 <strong class="secitem">
119 <xsl:value-of select="secondary"/>
120 <xsl:text>: </xsl:text>
121 </strong>
122 <xsl:for-each select="$refs[generate-id() = generate-id(key('secondary-section',
123 concat($key, &#34; &#34;, 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>
130 </xsl:for-each>
131 </li>
132 </xsl:template>
133
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"/>
138 <xsl:choose>
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;]"/>
144 <a>
145 <xsl:attribute name="href">
146 <xsl:call-template name="href.target.uri">
147 <xsl:with-param name="object" select="$target[1]"/>
148 </xsl:call-template>
149 </xsl:attribute>
150 <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
151 </a>
152 <xsl:text> -- </xsl:text>
153 <a>
154 <xsl:attribute name="href">
155 <xsl:call-template name="href.target.uri">
156 <xsl:with-param name="object" select="$target2[1]"/>
157 </xsl:call-template>
158 </xsl:attribute>
159 <xsl:text>description</xsl:text>
160 </a>
161 </xsl:when>
162 <xsl:otherwise>
163 <xsl:variable name="zone" select="$zones"/>
164 <xsl:variable name="target" select="key('sections', $zone)[&scope;]"/>
165 <a>
166 <xsl:attribute name="href">
167 <xsl:call-template name="href.target.uri">
168 <xsl:with-param name="object" select="$target[1]"/>
169 </xsl:call-template>
170 </xsl:attribute>
171 <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
172 </a>
173 </xsl:otherwise>
174 </xsl:choose>
175 </xsl:template>
176
177</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.