source: stylesheets/pdf/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.8 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 secondary 'normalize-space(concat(secondary/@sortas, secondary[not(@sortas)]))'>
7<!ENTITY scope 'count(ancestor::node()|$scope) = count(ancestor::node())'>
8<!ENTITY sep '" "'>
9]>
10
11<!-- Version 0.9 - Manuel Canales Esparcia <macana@lfs-es.org> -->
12
13<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
14 xmlns:fo="http://www.w3.org/1999/XSL/Format"
15 version="1.0">
16
17 <!--Only one column to fit the table layout-->
18 <xsl:param name="column.count.index" select="1"/>
19
20 <!--Title-->
21 <xsl:template match="index" mode="title.markup">
22 <xsl:text>Index of packages and important installed files</xsl:text>
23 </xsl:template>
24
25 <!-- Divisions-->
26 <xsl:template match="indexterm" mode="index-div">
27 <xsl:param name="scope" select="."/>
28 <xsl:variable name="key"
29 select="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
30 <xsl:variable name="divtitle" select="translate($key, &lowercase;, &uppercase;)"/>
31 <xsl:if test="key('letter', $key)[&scope;]
32 [count(.|key('primary', &primary;)[&scope;][1]) = 1]">
33 <fo:block>
34 <xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)">
35 <xsl:call-template name="indexdiv.title">
36 <xsl:with-param name="titlecontent">
37 <xsl:choose>
38 <xsl:when test="$divtitle = 'A'">
39 <xsl:text>Packages</xsl:text>
40 </xsl:when>
41 <xsl:when test="$divtitle = 'B'">
42 <xsl:text>Programs</xsl:text>
43 </xsl:when>
44 <xsl:when test="$divtitle = 'C'">
45 <xsl:text>Libraries</xsl:text>
46 </xsl:when>
47 <xsl:when test="$divtitle = 'D'">
48 <xsl:text>Scripts</xsl:text>
49 </xsl:when>
50 <xsl:when test="$divtitle = 'E'">
51 <xsl:text>Others</xsl:text>
52 </xsl:when>
53 <xsl:otherwise>
54 <xsl:value-of select="$divtitle"/>
55 </xsl:otherwise>
56 </xsl:choose>
57 </xsl:with-param>
58 </xsl:call-template>
59 </xsl:if>
60 <fo:table table-layout="fixed" width="100%">
61 <fo:table-column column-number="1" column-width="11em"/>
62 <fo:table-column column-number="2" column-width="19em"/>
63 <fo:table-column column-number="3"/>
64 <fo:table-body>
65 <xsl:apply-templates select="key('letter', $key)[&scope;]
66 [count(.|key('primary', &primary;)[&scope;][1])=1]"
67 mode="index-primary">
68 <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
69 <xsl:with-param name="scope" select="$scope"/>
70 </xsl:apply-templates>
71 </fo:table-body>
72 </fo:table>
73 </fo:block>
74 </xsl:if>
75 </xsl:template>
76
77 <!-- Dropping the separator from here -->
78 <xsl:template match="indexterm" mode="reference">
79 <xsl:param name="scope" select="."/>
80 <xsl:call-template name="reference">
81 <xsl:with-param name="zones" select="normalize-space(@zone)"/>
82 <xsl:with-param name="scope" select="$scope"/>
83 </xsl:call-template>
84 </xsl:template>
85
86 <!-- Changing the output tags and re-addind the separator-->
87 <xsl:template match="indexterm" mode="index-primary">
88 <xsl:param name="scope" select="."/>
89 <xsl:variable name="key" select="&primary;"/>
90 <xsl:variable name="refs" select="key('primary', $key)[&scope;]"/>
91 <fo:table-row>
92 <fo:table-cell>
93 <fo:block>
94 <xsl:value-of select="primary"/>
95 <xsl:text>: </xsl:text>
96 </fo:block>
97 </fo:table-cell>
98 <xsl:for-each select="$refs[not(see) and not(seealso)
99 and not(secondary)]">
100 <xsl:apply-templates select="." mode="reference">
101 <xsl:with-param name="scope" select="$scope"/>
102 </xsl:apply-templates>
103 </xsl:for-each>
104 </fo:table-row>
105 <xsl:if test="$refs/secondary">
106 <xsl:apply-templates select="$refs[secondary and count(.|key('secondary',
107 concat($key, &sep;, &secondary;))[&scope;][1]) = 1]" mode="index-secondary">
108 <xsl:with-param name="scope" select="$scope"/>
109 <xsl:sort select="translate(&secondary;, &lowercase;, &uppercase;)"/>
110 </xsl:apply-templates>
111 </xsl:if>
112 </xsl:template>
113
114 <xsl:template match="indexterm" mode="index-secondary">
115 <xsl:param name="scope" select="."/>
116 <xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;)"/>
117 <xsl:variable name="refs" select="key('secondary', $key)[&scope;]"/>
118 <fo:table-row>
119 <fo:table-cell>
120 <fo:block start-indent="1pc">
121 <xsl:value-of select="secondary"/>
122 <xsl:text>: </xsl:text>
123 </fo:block>
124 </fo:table-cell>
125 <xsl:for-each select="$refs[not(see) and not(seealso) and not(tertiary)]">
126 <xsl:apply-templates select="." mode="reference">
127 <xsl:with-param name="scope" select="$scope"/>
128 </xsl:apply-templates>
129 </xsl:for-each>
130 </fo:table-row>
131 </xsl:template>
132
133 <!-- Targets titles and bookmarks-->
134 <xsl:template name="reference">
135 <xsl:param name="scope" select="."/>
136 <xsl:param name="zones"/>
137 <xsl:choose>
138 <xsl:when test="contains($zones, ' ')">
139 <xsl:variable name="zone" select="substring-before($zones, ' ')"/>
140 <xsl:variable name="zone2" select="substring-after($zones, ' ')"/>
141 <xsl:variable name="target" select="key('id', $zone)[&scope;]"/>
142 <xsl:variable name="target2" select="key('id', $zone2)[&scope;]"/>
143 <xsl:variable name="id">
144 <xsl:call-template name="object.id">
145 <xsl:with-param name="object" select="$target[1]"/>
146 </xsl:call-template>
147 </xsl:variable>
148 <xsl:variable name="id2">
149 <xsl:call-template name="object.id">
150 <xsl:with-param name="object" select="$target2[1]"/>
151 </xsl:call-template>
152 </xsl:variable>
153 <fo:table-cell>
154 <fo:block>
155 <fo:basic-link internal-destination="{$id}">
156 <xsl:value-of select="$target/title"/>
157 <xsl:apply-templates select="$target" mode="page.citation">
158 <xsl:with-param name="id" select="$id"/>
159 </xsl:apply-templates>
160 </fo:basic-link>
161 </fo:block>
162 </fo:table-cell>
163 <fo:table-cell>
164 <fo:block>
165 <fo:basic-link internal-destination="{$id2}">
166 <xsl:text>description</xsl:text>
167 <xsl:apply-templates select="$target2" mode="page.citation">
168 <xsl:with-param name="id" select="$id2"/>
169 </xsl:apply-templates>
170 </fo:basic-link>
171 </fo:block>
172 </fo:table-cell>
173 </xsl:when>
174 <xsl:otherwise>
175 <xsl:variable name="zone" select="$zones"/>
176 <xsl:variable name="target" select="key('id', $zone)[&scope;]"/>
177 <xsl:variable name="id">
178 <xsl:call-template name="object.id">
179 <xsl:with-param name="object" select="$target[1]"/>
180 </xsl:call-template>
181 </xsl:variable>
182 <fo:table-cell>
183 <fo:block>
184 <fo:basic-link internal-destination="{$id}">
185 <xsl:value-of select="$target/title"/>
186 <xsl:apply-templates select="$target" mode="page.citation">
187 <xsl:with-param name="id" select="$id"/>
188 </xsl:apply-templates>
189 </fo:basic-link>
190 </fo:block>
191 </fo:table-cell>
192 </xsl:otherwise>
193 </xsl:choose>
194 </xsl:template>
195
196</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.