1 | <?xml version='1.0' encoding='ISO-8859-1'?>
|
---|
2 |
|
---|
3 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
4 | xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
---|
5 | version="1.0">
|
---|
6 |
|
---|
7 |
|
---|
8 | <!-- This is a hack and isn't correct semantically. Theoretically, the beginpage
|
---|
9 | tags should be placed in the XML source only to render the PDF output and
|
---|
10 | should be removed after it. But there is no a better way and we need this.-->
|
---|
11 | <xsl:template match="beginpage">
|
---|
12 | <fo:block break-after="page"/>
|
---|
13 | </xsl:template>
|
---|
14 |
|
---|
15 | <!-- Allow forced line breaks inside paragraphs emulating literallayout
|
---|
16 | and to remove vertical space in pachages and patches pages. -->
|
---|
17 | <xsl:template match="para">
|
---|
18 | <xsl:choose>
|
---|
19 | <xsl:when test="child::ulink[@url=' ']"/>
|
---|
20 | <xsl:when test="./@remap='verbatim'">
|
---|
21 | <fo:block wrap-option="no-wrap"
|
---|
22 | white-space-collapse="false"
|
---|
23 | white-space-treatment="preserve"
|
---|
24 | text-align="start"
|
---|
25 | linefeed-treatment="preserve">
|
---|
26 | <xsl:call-template name="anchor"/>
|
---|
27 | <xsl:apply-templates/>
|
---|
28 | </fo:block>
|
---|
29 | </xsl:when>
|
---|
30 | <xsl:when test="ancestor::variablelist/@role = 'materials'">
|
---|
31 | <fo:block>
|
---|
32 | <xsl:attribute name="space-before.optimum">0.1em</xsl:attribute>
|
---|
33 | <xsl:attribute name="space-before.minimum">0em</xsl:attribute>
|
---|
34 | <xsl:attribute name="space-before.maximum">0.2em</xsl:attribute>
|
---|
35 | <xsl:call-template name="anchor"/>
|
---|
36 | <xsl:apply-templates/>
|
---|
37 | </fo:block>
|
---|
38 | </xsl:when>
|
---|
39 | <xsl:otherwise>
|
---|
40 | <xsl:apply-imports/>
|
---|
41 | </xsl:otherwise>
|
---|
42 | </xsl:choose>
|
---|
43 | </xsl:template>
|
---|
44 |
|
---|
45 | <!-- Show URLs in italic font -->
|
---|
46 | <xsl:template match="ulink" name="ulink">
|
---|
47 | <fo:inline font-style="italic">
|
---|
48 | <fo:basic-link xsl:use-attribute-sets="xref.properties">
|
---|
49 | <xsl:attribute name="external-destination">
|
---|
50 | <xsl:call-template name="fo-external-image">
|
---|
51 | <xsl:with-param name="filename" select="@url"/>
|
---|
52 | </xsl:call-template>
|
---|
53 | </xsl:attribute>
|
---|
54 | <xsl:choose>
|
---|
55 | <xsl:when test="count(child::node())=0">
|
---|
56 | <xsl:call-template name="hyphenate-url">
|
---|
57 | <xsl:with-param name="url" select="@url"/>
|
---|
58 | </xsl:call-template>
|
---|
59 | </xsl:when>
|
---|
60 | <xsl:otherwise>
|
---|
61 | <xsl:apply-templates/>
|
---|
62 | </xsl:otherwise>
|
---|
63 | </xsl:choose>
|
---|
64 | </fo:basic-link>
|
---|
65 | </fo:inline>
|
---|
66 | <xsl:if test="count(child::node()) != 0
|
---|
67 | and string(.) != @url
|
---|
68 | and $ulink.show != 0">
|
---|
69 | <!-- yes, show the URI -->
|
---|
70 | <xsl:choose>
|
---|
71 | <xsl:when test="$ulink.footnotes != 0 and not(ancestor::footnote)">
|
---|
72 | <xsl:text> </xsl:text>
|
---|
73 | <fo:footnote>
|
---|
74 | <xsl:call-template name="ulink.footnote.number"/>
|
---|
75 | <fo:footnote-body font-family="{$body.fontset}"
|
---|
76 | font-size="{$footnote.font.size}">
|
---|
77 | <fo:block>
|
---|
78 | <xsl:call-template name="ulink.footnote.number"/>
|
---|
79 | <xsl:text> </xsl:text>
|
---|
80 | <fo:inline>
|
---|
81 | <xsl:value-of select="@url"/>
|
---|
82 | </fo:inline>
|
---|
83 | </fo:block>
|
---|
84 | </fo:footnote-body>
|
---|
85 | </fo:footnote>
|
---|
86 | </xsl:when>
|
---|
87 | <xsl:otherwise>
|
---|
88 | <fo:inline hyphenate="false">
|
---|
89 | <xsl:text> [</xsl:text>
|
---|
90 | <xsl:call-template name="hyphenate-url">
|
---|
91 | <xsl:with-param name="url" select="@url"/>
|
---|
92 | </xsl:call-template>
|
---|
93 | <xsl:text>]</xsl:text>
|
---|
94 | </fo:inline>
|
---|
95 | </xsl:otherwise>
|
---|
96 | </xsl:choose>
|
---|
97 | </xsl:if>
|
---|
98 | </xsl:template>
|
---|
99 |
|
---|
100 | <!-- Split URLs (obsolete, keeped as reference) -->
|
---|
101 | <!--<xsl:template name="hyphenate-url">
|
---|
102 | <xsl:param name="url" select="''"/>
|
---|
103 | <xsl:choose>
|
---|
104 | <xsl:when test="ancestor::varlistentry">
|
---|
105 | <xsl:choose>
|
---|
106 | <xsl:when test="string-length($url) > 90">
|
---|
107 | <xsl:value-of select="substring($url, 1, 50)"/>
|
---|
108 | <xsl:param name="rest" select="substring($url, 51)"/>
|
---|
109 | <xsl:value-of select="substring-before($rest, '/')"/>
|
---|
110 | <xsl:text> /</xsl:text>
|
---|
111 | <xsl:value-of select="substring-after($rest, '/')"/>
|
---|
112 | </xsl:when>
|
---|
113 | <xsl:otherwise>
|
---|
114 | <xsl:value-of select="$url"/>
|
---|
115 | </xsl:otherwise>
|
---|
116 | </xsl:choose>
|
---|
117 | </xsl:when>
|
---|
118 | <xsl:otherwise>
|
---|
119 | <xsl:value-of select="$url"/>-->
|
---|
120 | <!-- <xsl:value-of select="substring-before($url, '//')"/>
|
---|
121 | <xsl:text>// </xsl:text>
|
---|
122 | <xsl:call-template name="split-url">
|
---|
123 | <xsl:with-param name="url2" select="substring-after($url, '//')"/>
|
---|
124 | </xsl:call-template>-->
|
---|
125 | <!-- </xsl:otherwise>
|
---|
126 | </xsl:choose>
|
---|
127 | </xsl:template>-->
|
---|
128 |
|
---|
129 | <!--<xsl:template name="split-url">
|
---|
130 | <xsl:choose>
|
---|
131 | <xsl:when test="contains($url2, '/')">
|
---|
132 | <xsl:param name="url2" select="''"/>
|
---|
133 | <xsl:value-of select="substring-before($url2, '/')"/>
|
---|
134 | <xsl:text> /</xsl:text>
|
---|
135 | <xsl:call-template name="split-url">
|
---|
136 | <xsl:with-param name="url2" select="substring-after($url2, '/')"/>
|
---|
137 | </xsl:call-template>
|
---|
138 | </xsl:when>
|
---|
139 | <xsl:otherwise>
|
---|
140 | <xsl:value-of select="$url2"/>
|
---|
141 | </xsl:otherwise>
|
---|
142 | </xsl:choose>
|
---|
143 | </xsl:template>-->
|
---|
144 |
|
---|
145 | <!-- Shade screen -->
|
---|
146 | <xsl:param name="shade.verbatim" select="1"/>
|
---|
147 |
|
---|
148 | <!-- How is rendered by default a variablelist -->
|
---|
149 | <xsl:param name="variablelist.as.blocks" select="1"/>
|
---|
150 | <xsl:param name="variablelist.max.termlength">32</xsl:param>
|
---|
151 |
|
---|
152 | <!-- Adding space before segmentedlist -->
|
---|
153 | <xsl:template match="segmentedlist">
|
---|
154 | <!--<xsl:variable name="presentation">
|
---|
155 | <xsl:call-template name="pi-attribute">
|
---|
156 | <xsl:with-param name="pis"
|
---|
157 | select="processing-instruction('dbfo')"/>
|
---|
158 | <xsl:with-param name="attribute" select="'list-presentation'"/>
|
---|
159 | </xsl:call-template>
|
---|
160 | </xsl:variable>
|
---|
161 | <xsl:choose>
|
---|
162 | <xsl:when test="$presentation = 'table'">
|
---|
163 | <xsl:apply-templates select="." mode="seglist-table"/>
|
---|
164 | </xsl:when>
|
---|
165 | <xsl:when test="$presentation = 'list'">
|
---|
166 | <fo:block space-before.minimum="0.4em" space-before.optimum="0.6em"
|
---|
167 | space-before.maximum="0.8em">
|
---|
168 | <xsl:apply-templates/>
|
---|
169 | </fo:block>
|
---|
170 | </xsl:when>
|
---|
171 | <xsl:when test="$segmentedlist.as.table != 0">
|
---|
172 | <xsl:apply-templates select="." mode="seglist-table"/>
|
---|
173 | </xsl:when>
|
---|
174 | <xsl:otherwise>-->
|
---|
175 | <fo:block space-before.minimum="0.4em" space-before.optimum="0.6em"
|
---|
176 | space-before.maximum="0.8em">
|
---|
177 | <xsl:apply-templates/>
|
---|
178 | </fo:block>
|
---|
179 | <!--</xsl:otherwise>
|
---|
180 | </xsl:choose>-->
|
---|
181 | </xsl:template>
|
---|
182 |
|
---|
183 | <!-- Presentation of literal tag -->
|
---|
184 | <xsl:template match="literal">
|
---|
185 | <fo:inline font-weight="normal">
|
---|
186 | <xsl:call-template name="inline.monoseq"/>
|
---|
187 | </fo:inline>
|
---|
188 | </xsl:template>
|
---|
189 |
|
---|
190 | <!-- Left alingnament for itemizedlist -->
|
---|
191 | <xsl:template match="itemizedlist">
|
---|
192 | <xsl:variable name="id">
|
---|
193 | <xsl:call-template name="object.id"/>
|
---|
194 | </xsl:variable>
|
---|
195 | <xsl:variable name="label-width">
|
---|
196 | <xsl:call-template name="dbfo-attribute">
|
---|
197 | <xsl:with-param name="pis"
|
---|
198 | select="processing-instruction('dbfo')"/>
|
---|
199 | <xsl:with-param name="attribute" select="'label-width'"/>
|
---|
200 | </xsl:call-template>
|
---|
201 | </xsl:variable>
|
---|
202 | <xsl:if test="title">
|
---|
203 | <xsl:apply-templates select="title" mode="list.title.mode"/>
|
---|
204 | </xsl:if>
|
---|
205 | <!-- Preserve order of PIs and comments -->
|
---|
206 | <xsl:apply-templates
|
---|
207 | select="*[not(self::listitem
|
---|
208 | or self::title
|
---|
209 | or self::titleabbrev)]
|
---|
210 | |comment()[not(preceding-sibling::listitem)]
|
---|
211 | |processing-instruction()[not(preceding-sibling::listitem)]"/>
|
---|
212 | <fo:list-block id="{$id}" xsl:use-attribute-sets="list.block.spacing"
|
---|
213 | provisional-label-separation="0.2em" text-align="left">
|
---|
214 | <xsl:attribute name="provisional-distance-between-starts">
|
---|
215 | <xsl:choose>
|
---|
216 | <xsl:when test="$label-width != ''">
|
---|
217 | <xsl:value-of select="$label-width"/>
|
---|
218 | </xsl:when>
|
---|
219 | <xsl:otherwise>1.5em</xsl:otherwise>
|
---|
220 | </xsl:choose>
|
---|
221 | </xsl:attribute>
|
---|
222 | <xsl:apply-templates
|
---|
223 | select="listitem
|
---|
224 | |comment()[preceding-sibling::listitem]
|
---|
225 | |processing-instruction()[preceding-sibling::listitem]"/>
|
---|
226 | </fo:list-block>
|
---|
227 | </xsl:template>
|
---|
228 |
|
---|
229 | <!-- Addibg a bullet, and left alignament, for packages and paches list. -->
|
---|
230 |
|
---|
231 | <xsl:template match="varlistentry" mode="vl.as.blocks">
|
---|
232 | <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
|
---|
233 | <xsl:choose>
|
---|
234 | <xsl:when test="ancestor::variablelist/@role = 'materials'">
|
---|
235 | <fo:block id="{$id}" xsl:use-attribute-sets="list.item.spacing"
|
---|
236 | keep-together.within-column="always"
|
---|
237 | keep-with-next.within-column="always" text-align="left">
|
---|
238 | <xsl:text>• </xsl:text>
|
---|
239 | <xsl:apply-templates select="term"/>
|
---|
240 | </fo:block>
|
---|
241 | <fo:block margin-left="1.4pc" text-align="left">
|
---|
242 | <xsl:apply-templates select="listitem"/>
|
---|
243 | </fo:block>
|
---|
244 | </xsl:when>
|
---|
245 | <xsl:otherwise>
|
---|
246 | <fo:block id="{$id}" xsl:use-attribute-sets="list.item.spacing"
|
---|
247 | keep-together.within-column="always"
|
---|
248 | keep-with-next.within-column="always">
|
---|
249 | <xsl:apply-templates select="term"/>
|
---|
250 | </fo:block>
|
---|
251 | <fo:block margin-left="0.25in">
|
---|
252 | <xsl:apply-templates select="listitem"/>
|
---|
253 | </fo:block>
|
---|
254 | </xsl:otherwise>
|
---|
255 | </xsl:choose>
|
---|
256 | </xsl:template>
|
---|
257 |
|
---|
258 | <!-- Total packages size calculation -->
|
---|
259 | <xsl:template match="returnvalue">
|
---|
260 | <xsl:call-template name="calculation">
|
---|
261 | <xsl:with-param name="scope" select="../../variablelist"/>
|
---|
262 | </xsl:call-template>
|
---|
263 | </xsl:template>
|
---|
264 |
|
---|
265 | <xsl:template name="calculation">
|
---|
266 | <xsl:param name="scope"/>
|
---|
267 | <xsl:param name="total">0</xsl:param>
|
---|
268 | <xsl:param name="position">1</xsl:param>
|
---|
269 | <xsl:variable name="tokens" select="count($scope/varlistentry)"/>
|
---|
270 | <xsl:variable name="token" select="$scope/varlistentry[$position]/term/token"/>
|
---|
271 | <xsl:variable name="size" select="substring-before($token,' KB')"/>
|
---|
272 | <xsl:variable name="rawsize">
|
---|
273 | <xsl:choose>
|
---|
274 | <xsl:when test="contains($size,',')">
|
---|
275 | <xsl:value-of select="concat(substring-before($size,','),substring-after($size,','))"/>
|
---|
276 | </xsl:when>
|
---|
277 | <xsl:otherwise>
|
---|
278 | <xsl:value-of select="$size"/>
|
---|
279 | </xsl:otherwise>
|
---|
280 | </xsl:choose>
|
---|
281 | </xsl:variable>
|
---|
282 | <xsl:choose>
|
---|
283 | <xsl:when test="$position <= $tokens">
|
---|
284 | <xsl:call-template name="calculation">
|
---|
285 | <xsl:with-param name="scope" select="$scope"/>
|
---|
286 | <xsl:with-param name="position" select="$position +1"/>
|
---|
287 | <xsl:with-param name="total" select="$total + $rawsize"/>
|
---|
288 | </xsl:call-template>
|
---|
289 | </xsl:when>
|
---|
290 | <xsl:otherwise>
|
---|
291 | <xsl:choose>
|
---|
292 | <xsl:when test="$total < '1000'">
|
---|
293 | <xsl:value-of select="$total"/>
|
---|
294 | <xsl:text> KB</xsl:text>
|
---|
295 | </xsl:when>
|
---|
296 | <xsl:when test="$total > '1000' and $total < '5000'">
|
---|
297 | <xsl:value-of select="substring($total,1,1)"/>
|
---|
298 | <xsl:text>,</xsl:text>
|
---|
299 | <xsl:value-of select="substring($total,2)"/>
|
---|
300 | <xsl:text> KB</xsl:text>
|
---|
301 | </xsl:when>
|
---|
302 | <xsl:otherwise>
|
---|
303 | <xsl:value-of select="round($total div 1024)"/>
|
---|
304 | <xsl:text> MB</xsl:text>
|
---|
305 | </xsl:otherwise>
|
---|
306 | </xsl:choose>
|
---|
307 | </xsl:otherwise>
|
---|
308 | </xsl:choose>
|
---|
309 | </xsl:template>
|
---|
310 |
|
---|
311 | </xsl:stylesheet>
|
---|