comparison flys-artifacts/contrib/fixoverview2html.xsl @ 3431:0568ffd29bb2

FixA: Introduced i18n to overview transformation. flys-artifacts/trunk@5091 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sat, 21 Jul 2012 12:26:12 +0000
parents 3353672f9ba2
children 9c39a25aa849
comparison
equal deleted inserted replaced
3430:278b5508567e 3431:0568ffd29bb2
9 9
10 <xsl:param name="project-uuid">de3f3307-3429-4ff9-8f43-3fb2fcf21b27</xsl:param> 10 <xsl:param name="project-uuid">de3f3307-3429-4ff9-8f43-3fb2fcf21b27</xsl:param>
11 <xsl:param name="render-checkboxes" select="true()"/> 11 <xsl:param name="render-checkboxes" select="true()"/>
12 <xsl:param name="callback"/> 12 <xsl:param name="callback"/>
13 13
14 <xsl:param name="locale">de</xsl:param>
15
16 <xsl:decimal-format name="de" decimal-separator=',' grouping-separator='.'/>
17 <xsl:decimal-format name="en" decimal-separator='.' grouping-separator=','/>
18
19 <xsl:variable name="km-pattern">
20 <xsl:choose>
21 <xsl:when test="$locale = 'de'">0,##</xsl:when>
22 <xsl:otherwise>0.##</xsl:otherwise>
23 </xsl:choose>
24 </xsl:variable>
25
26 <xsl:variable name="i18n-event">Ereignis</xsl:variable>
27 <xsl:variable name="i18n-legend">Legende</xsl:variable>
28 <xsl:variable name="i18n-color">Farbe</xsl:variable>
29 <xsl:variable name="i18n-meaning">Bedeutung</xsl:variable>
30 <xsl:variable name="i18n-around-mnq">um MNQ</xsl:variable>
31 <xsl:variable name="i18n-around-mq">um MQ</xsl:variable>
32 <xsl:variable name="i18n-around-mhq">um MHQ</xsl:variable>
33 <xsl:variable name="i18n-above-hq5">über HQ5</xsl:variable>
34
35 <!-- TODO: Format dates according locale. -->
36
14 <xsl:template match="@*" mode="min"> 37 <xsl:template match="@*" mode="min">
15 <xsl:if test="position() = 1"> 38 <xsl:if test="position() = 1">
16 <xsl:value-of select="number(.)"/> 39 <xsl:value-of select="number(.)"/>
17 </xsl:if> 40 </xsl:if>
18 </xsl:template> 41 </xsl:template>
23 </xsl:if> 46 </xsl:if>
24 </xsl:template> 47 </xsl:template>
25 48
26 <xsl:variable name="global-min"> 49 <xsl:variable name="global-min">
27 <xsl:choose> 50 <xsl:choose>
28 <xsl:when test="count(/fixings/events/event) &gt; 0"> 51 <xsl:when test="count(/fixings/events/event/sector) &gt; 0">
29 <xsl:apply-templates mode="min" select="/fixings/events/event/sector/@from"> 52 <xsl:apply-templates mode="min" select="/fixings/events/event/sector/@from">
30 <xsl:sort data-type="number" select="."/> 53 <xsl:sort data-type="number" select="."/>
31 </xsl:apply-templates> 54 </xsl:apply-templates>
32 </xsl:when> 55 </xsl:when>
33 <xsl:otherwise> 56 <xsl:otherwise>
36 </xsl:choose> 59 </xsl:choose>
37 </xsl:variable> 60 </xsl:variable>
38 61
39 <xsl:variable name="global-max"> 62 <xsl:variable name="global-max">
40 <xsl:choose> 63 <xsl:choose>
41 <xsl:when test="count(/fixings/events/event) &gt; 0"> 64 <xsl:when test="count(/fixings/events/event/sector) &gt; 0">
42 <xsl:apply-templates mode="max" select="/fixings/events/event/sector/@to"> 65 <xsl:apply-templates mode="max" select="/fixings/events/event/sector/@to">
43 <xsl:sort data-type="number" select="."/> 66 <xsl:sort data-type="number" select="."/>
44 </xsl:apply-templates> 67 </xsl:apply-templates>
45 </xsl:when> 68 </xsl:when>
46 <xsl:otherwise> 69 <xsl:otherwise>
165 <xsl:text>%</xsl:text> 188 <xsl:text>%</xsl:text>
166 <xsl:text>;float:left</xsl:text> 189 <xsl:text>;float:left</xsl:text>
167 </xsl:attribute> 190 </xsl:attribute>
168 <xsl:attribute name="title"> 191 <xsl:attribute name="title">
169 <xsl:text>km </xsl:text> 192 <xsl:text>km </xsl:text>
170 <xsl:value-of select="@from"/> 193 <xsl:value-of select="format-number(@from, $km-pattern, $locale)"/>
171 <xsl:text> - </xsl:text> 194 <xsl:text> - </xsl:text>
172 <xsl:value-of select="@to"/> 195 <xsl:value-of select="format-number(@to, $km-pattern, $locale)"/>
173 <xsl:choose> 196 <xsl:choose>
174 <xsl:when test="@class = '0'"> / Q um MNQ</xsl:when> 197 <xsl:when test="@class = '0'"> / Q <xsl:value-of select="$i18n-around-mnq"/></xsl:when>
175 <xsl:when test="@class = '1'"> / Q um MQ</xsl:when> 198 <xsl:when test="@class = '1'"> / Q <xsl:value-of select="$i18n-around-mq"/></xsl:when>
176 <xsl:when test="@class = '2'"> / Q um MHQ</xsl:when> 199 <xsl:when test="@class = '2'"> / Q <xsl:value-of select="$i18n-around-mhq"/></xsl:when>
177 <xsl:when test="@class = '3'"> / Q über HQ5</xsl:when> 200 <xsl:when test="@class = '3'"> / Q <xsl:value-of select="$i18n-above-hq5"/></xsl:when>
178 </xsl:choose> 201 </xsl:choose>
179 </xsl:attribute> 202 </xsl:attribute>
180 <xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text> 203 <xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text>
181 </div> 204 </div>
182 </xsl:template> 205 </xsl:template>
205 <div> 228 <div>
206 <xsl:attribute name="style"> 229 <xsl:attribute name="style">
207 <xsl:text>overflow:hidden;background:</xsl:text> 230 <xsl:text>overflow:hidden;background:</xsl:text>
208 <xsl:choose> 231 <xsl:choose>
209 <xsl:when test="(count(preceding::*) mod 2) = 0">#ada96e</xsl:when> 232 <xsl:when test="(count(preceding::*) mod 2) = 0">#ada96e</xsl:when>
210 <xsl:otherwise>gray</xsl:otherwise> 233 <xsl:otherwise>silver</xsl:otherwise>
211 </xsl:choose> 234 </xsl:choose>
212 <xsl:text>;width:</xsl:text> 235 <xsl:text>;width:</xsl:text>
213 <xsl:call-template name="percent"> 236 <xsl:call-template name="percent">
214 <xsl:with-param name="sector" select="."/> 237 <xsl:with-param name="sector" select="."/>
215 </xsl:call-template> 238 </xsl:call-template>
217 <xsl:text>;float:left</xsl:text> 240 <xsl:text>;float:left</xsl:text>
218 </xsl:attribute> 241 </xsl:attribute>
219 <xsl:attribute name="title"> 242 <xsl:attribute name="title">
220 <xsl:value-of select="@name"/> 243 <xsl:value-of select="@name"/>
221 <xsl:text>: km </xsl:text> 244 <xsl:text>: km </xsl:text>
222 <xsl:value-of select="@from"/> 245 <xsl:value-of select="format-number(@from, $km-pattern, $locale)"/>
223 <xsl:text> - </xsl:text> 246 <xsl:text> - </xsl:text>
224 <xsl:value-of select="@to"/> 247 <xsl:value-of select="format-number(@to, $km-pattern, $locale)"/>
225 </xsl:attribute> 248 </xsl:attribute>
226 <nobr><xsl:value-of select="@name"/></nobr> 249 <nobr><xsl:value-of select="@name"/></nobr>
227 </div> 250 </div>
228 </xsl:template> 251 </xsl:template>
229 252
240 <tr> 263 <tr>
241 <xsl:if test="$render-checkboxes"> 264 <xsl:if test="$render-checkboxes">
242 <th>&#160;</th> 265 <th>&#160;</th>
243 </xsl:if> 266 </xsl:if>
244 <th><xsl:apply-templates mode="gauges" select="/fixings/gauges"/></th> 267 <th><xsl:apply-templates mode="gauges" select="/fixings/gauges"/></th>
245 <th>Ereignis</th> 268 <th><xsl:value-of select="$i18n-event"/></th>
246 </tr> 269 </tr>
247 <xsl:apply-templates/> 270 <xsl:apply-templates/>
248 </table> 271 </table>
249 </xsl:template> 272 </xsl:template>
250 273
255 </head> 278 </head>
256 <body> 279 <body>
257 <xsl:apply-templates/> 280 <xsl:apply-templates/>
258 <hr/> 281 <hr/>
259 <table border="1" cellspacing="0" cellpadding="0"> 282 <table border="1" cellspacing="0" cellpadding="0">
260 <caption>Legende</caption> 283 <caption><xsl:value-of select="$i18n-legend"/></caption>
261 <tr> 284 <tr>
262 <th>Farbe</th> 285 <th><xsl:value-of select="$i18n-color"/></th>
263 <th colspan="2">Bedeutung</th> 286 <th colspan="2"><xsl:value-of select="$i18n-meaning"/></th>
264 </tr> 287 </tr>
265 <xsl:if test="count(/fixings/events/event/sector[@class = '0']) &gt; 0"> 288 <xsl:if test="count(/fixings/events/event/sector[@class = '0']) &gt; 0">
266 <tr> 289 <tr>
267 <td style="background: green">&#160;</td> 290 <td style="background: green">&#160;</td>
268 <td>um MNQ</td> 291 <td><xsl:value-of select="$i18n-around-mnq"/></td>
269 <td>Q &#8712; [0, (MNQ+MQ)/2)</td> 292 <td>Q &#8712; [0, (MNQ+MQ)/2)</td>
270 </tr> 293 </tr>
271 </xsl:if> 294 </xsl:if>
272 <xsl:if test="count(/fixings/events/event/sector[@class = '1']) &gt; 0"> 295 <xsl:if test="count(/fixings/events/event/sector[@class = '1']) &gt; 0">
273 <tr> 296 <tr>
274 <td style="background: blue">&#160;</td> 297 <td style="background: blue">&#160;</td>
275 <td>um MQ</td> 298 <td><xsl:value-of select="$i18n-around-mq"/></td>
276 <td>Q &#8712; [(MNQ+MQ)/2, (MQ+MHQ)/2)</td> 299 <td>Q &#8712; [(MNQ+MQ)/2, (MQ+MHQ)/2)</td>
277 </tr> 300 </tr>
278 </xsl:if> 301 </xsl:if>
279 <xsl:if test="count(/fixings/events/event/sector[@class = '2']) &gt; 0"> 302 <xsl:if test="count(/fixings/events/event/sector[@class = '2']) &gt; 0">
280 <tr> 303 <tr>
281 <td style="background: magenta">&#160;</td> 304 <td style="background: magenta">&#160;</td>
282 <td>um MHQ</td> 305 <td><xsl:value-of select="$i18n-around-mhq"/></td>
283 <td>Q &#8712; [(MQ+MHQ)/2, HQ5)</td> 306 <td>Q &#8712; [(MQ+MHQ)/2, HQ5)</td>
284 </tr> 307 </tr>
285 </xsl:if> 308 </xsl:if>
286 <xsl:if test="count(/fixings/events/event/sector[@class = '3']) &gt; 0"> 309 <xsl:if test="count(/fixings/events/event/sector[@class = '3']) &gt; 0">
287 <tr> 310 <tr>
288 <td style="background: red">&#160;</td> 311 <td style="background: red">&#160;</td>
289 <td>über HQ5</td> 312 <td><xsl:value-of select="$i18n-above-hq5"/></td>
290 <td>Q &#8712; [HQ5, &#8734;)</td> 313 <td>Q &#8712; [HQ5, &#8734;)</td>
291 </tr> 314 </tr>
292 </xsl:if> 315 </xsl:if>
293 </table> 316 </table>
294 </body> 317 </body>

http://dive4elements.wald.intevation.org