source: stylesheets/xhtml/lfs-mixed.xsl@ d9dc49a

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.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 d9dc49a was 037ab68, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Moved packages.xml info to packages.ent.
Automatized total packages size calculation.

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

  • Property mode set to 100644
File size: 8.2 KB
Line 
1<?xml version='1.0' encoding='ISO-8859-1'?>
2
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns="http://www.w3.org/1999/xhtml"
5 version="1.0">
6
7 <!-- para -->
8 <xsl:template match="para">
9 <xsl:choose>
10 <xsl:when test="child::ulink[@url=' ']"/>
11 <xsl:otherwise>
12 <xsl:call-template name="paragraph">
13 <xsl:with-param name="class">
14 <xsl:if test="@role and $para.propagates.style != 0">
15 <xsl:value-of select="@role"/>
16 </xsl:if>
17 </xsl:with-param>
18 <xsl:with-param name="content">
19 <xsl:if test="position() = 1 and parent::listitem">
20 <xsl:call-template name="anchor">
21 <xsl:with-param name="node" select="parent::listitem"/>
22 </xsl:call-template>
23 </xsl:if>
24 <xsl:call-template name="anchor"/>
25 <xsl:apply-templates/>
26 </xsl:with-param>
27 </xsl:call-template>
28 </xsl:otherwise>
29 </xsl:choose>
30 </xsl:template>
31
32 <!-- screen -->
33 <xsl:template match="screen">
34 <xsl:choose>
35 <xsl:when test="child::* = userinput">
36 <pre class="userinput">
37 <xsl:apply-templates/>
38 </pre>
39 </xsl:when>
40 <xsl:otherwise>
41 <pre class="{name(.)}">
42 <xsl:apply-templates/>
43 </pre>
44 </xsl:otherwise>
45 </xsl:choose>
46 </xsl:template>
47
48 <xsl:template match="userinput">
49 <xsl:choose>
50 <xsl:when test="ancestor::screen">
51 <kbd class="command">
52 <xsl:apply-templates/>
53 </kbd>
54 </xsl:when>
55 <xsl:otherwise>
56 <xsl:apply-imports/>
57 </xsl:otherwise>
58 </xsl:choose>
59 </xsl:template>
60
61 <!-- segementedlist -->
62 <xsl:template match="seg">
63 <xsl:variable name="segnum" select="count(preceding-sibling::seg)+1"/>
64 <xsl:variable name="seglist" select="ancestor::segmentedlist"/>
65 <xsl:variable name="segtitles" select="$seglist/segtitle"/>
66 <!-- Note: segtitle is only going to be the right thing in a well formed
67 SegmentedList. If there are too many Segs or too few SegTitles,
68 you'll get something odd...maybe an error -->
69 <div class="seg">
70 <strong>
71 <span class="segtitle">
72 <xsl:apply-templates select="$segtitles[$segnum=position()]" mode="segtitle-in-seg"/>
73 <xsl:text>: </xsl:text>
74 </span>
75 </strong>
76 <span class="seg">
77 <xsl:apply-templates/>
78 </span>
79 </div>
80 </xsl:template>
81
82
83 <!-- variablelist -->
84 <xsl:template match="variablelist">
85 <xsl:choose>
86 <xsl:when test="@role">
87 <div class="{@role}">
88 <xsl:apply-imports/>
89 </div>
90 </xsl:when>
91 <xsl:otherwise>
92 <xsl:apply-imports/>
93 </xsl:otherwise>
94 </xsl:choose>
95 </xsl:template>
96
97
98 <!-- Body attributes -->
99 <xsl:template name="body.attributes">
100 <xsl:attribute name="id">
101 <xsl:text>lfs</xsl:text>
102 </xsl:attribute>
103 <xsl:attribute name="class">
104 <xsl:value-of select="substring-after(/book/bookinfo/subtitle, ' ')"/>
105 </xsl:attribute>
106 </xsl:template>
107
108 <!-- External URLs in italic font -->
109 <xsl:template match="ulink" name="ulink">
110 <a>
111 <xsl:if test="@id">
112 <xsl:attribute name="id">
113 <xsl:value-of select="@id"/>
114 </xsl:attribute>
115 </xsl:if>
116 <xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
117 <i>
118 <xsl:choose>
119 <xsl:when test="count(child::node())=0">
120 <xsl:value-of select="@url"/>
121 </xsl:when>
122 <xsl:otherwise>
123 <xsl:apply-templates/>
124 </xsl:otherwise>
125 </xsl:choose>
126 </i>
127 </a>
128 </xsl:template>
129
130 <!-- The <code> xhtml tag have look issues in some browsers, like Konqueror and.
131 isn't semantically correct (a filename isn't a code fragment) We will use <tt> for now. -->
132 <xsl:template name="inline.monoseq">
133 <xsl:param name="content">
134 <xsl:call-template name="anchor"/>
135 <xsl:call-template name="simple.xlink">
136 <xsl:with-param name="content">
137 <xsl:apply-templates/>
138 </xsl:with-param>
139 </xsl:call-template>
140 </xsl:param>
141 <tt class="{local-name(.)}">
142 <xsl:if test="@dir">
143 <xsl:attribute name="dir">
144 <xsl:value-of select="@dir"/>
145 </xsl:attribute>
146 </xsl:if>
147 <xsl:copy-of select="$content"/>
148 </tt>
149 </xsl:template>
150
151 <xsl:template name="inline.boldmonoseq">
152 <xsl:param name="content">
153 <xsl:call-template name="anchor"/>
154 <xsl:call-template name="simple.xlink">
155 <xsl:with-param name="content">
156 <xsl:apply-templates/>
157 </xsl:with-param>
158 </xsl:call-template>
159 </xsl:param>
160 <!-- don't put <strong> inside figure, example, or table titles -->
161 <!-- or other titles that may already be represented with <strong>'s. -->
162 <xsl:choose>
163 <xsl:when test="local-name(..) = 'title' and (local-name(../..) = 'figure'
164 or local-name(../..) = 'example' or local-name(../..) = 'table' or local-name(../..) = 'formalpara')">
165 <tt class="{local-name(.)}">
166 <xsl:if test="@dir">
167 <xsl:attribute name="dir">
168 <xsl:value-of select="@dir"/>
169 </xsl:attribute>
170 </xsl:if>
171 <xsl:copy-of select="$content"/>
172 </tt>
173 </xsl:when>
174 <xsl:otherwise>
175 <strong class="{local-name(.)}">
176 <tt>
177 <xsl:if test="@dir">
178 <xsl:attribute name="dir">
179 <xsl:value-of select="@dir"/>
180 </xsl:attribute>
181 </xsl:if>
182 <xsl:copy-of select="$content"/>
183 </tt>
184 </strong>
185 </xsl:otherwise>
186 </xsl:choose>
187 </xsl:template>
188
189 <xsl:template name="inline.italicmonoseq">
190 <xsl:param name="content">
191 <xsl:call-template name="anchor"/>
192 <xsl:call-template name="simple.xlink">
193 <xsl:with-param name="content">
194 <xsl:apply-templates/>
195 </xsl:with-param>
196 </xsl:call-template>
197 </xsl:param>
198 <em class="{local-name(.)}">
199 <tt>
200 <xsl:if test="@dir">
201 <xsl:attribute name="dir">
202 <xsl:value-of select="@dir"/>
203 </xsl:attribute>
204 </xsl:if>
205 <xsl:copy-of select="$content"/>
206 </tt>
207 </em>
208 </xsl:template>
209
210 <!-- Total packages size calculation -->
211 <xsl:template match="returnvalue">
212 <xsl:call-template name="calculation">
213 <xsl:with-param name="scope" select="../../variablelist"/>
214 </xsl:call-template>
215 </xsl:template>
216
217 <xsl:template name="calculation">
218 <xsl:param name="scope"/>
219 <xsl:param name="total">0</xsl:param>
220 <xsl:param name="position">1</xsl:param>
221 <xsl:variable name="tokens" select="count($scope/varlistentry)"/>
222 <xsl:variable name="token" select="$scope/varlistentry[$position]/term/token"/>
223 <xsl:variable name="size" select="substring-before($token,' KB')"/>
224 <xsl:variable name="rawsize">
225 <xsl:choose>
226 <xsl:when test="contains($size,',')">
227 <xsl:value-of select="concat(substring-before($size,','),substring-after($size,','))"/>
228 </xsl:when>
229 <xsl:otherwise>
230 <xsl:value-of select="$size"/>
231 </xsl:otherwise>
232 </xsl:choose>
233 </xsl:variable>
234 <xsl:choose>
235 <xsl:when test="$position &lt;= $tokens">
236 <xsl:call-template name="calculation">
237 <xsl:with-param name="scope" select="$scope"/>
238 <xsl:with-param name="position" select="$position +1"/>
239 <xsl:with-param name="total" select="$total + $rawsize"/>
240 </xsl:call-template>
241 </xsl:when>
242 <xsl:otherwise>
243 <xsl:choose>
244 <xsl:when test="$total &lt; '1000'">
245 <xsl:value-of select="$total"/>
246 <xsl:text> KB</xsl:text>
247 </xsl:when>
248 <xsl:when test="$total &gt; '1000' and $total &lt; '5000'">
249 <xsl:value-of select="substring($total,1,1)"/>
250 <xsl:text>,</xsl:text>
251 <xsl:value-of select="substring($total,2)"/>
252 <xsl:text> KB</xsl:text>
253 </xsl:when>
254 <xsl:otherwise>
255 <xsl:value-of select="round($total div 1024)"/>
256 <xsl:text> MB</xsl:text>
257 </xsl:otherwise>
258 </xsl:choose>
259 </xsl:otherwise>
260 </xsl:choose>
261 </xsl:template>
262
263
264</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.