Mercurial > dive4elements > river
comparison flys-client/src/main/webapp/WEB-INF/stylesheets/fixoverview2html.xsl @ 3376:653dd9d7f5d5
FixA: Introduce i18n to overview transformation.
flys-client/trunk@5093 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sat, 21 Jul 2012 13:13:21 +0000 |
parents | 87c0a06743b8 |
children | a5c790ed09bd |
comparison
equal
deleted
inserted
replaced
3375:87c0a06743b8 | 3376:653dd9d7f5d5 |
---|---|
7 | 7 |
8 <xsl:param name="project-uuid">de3f3307-3429-4ff9-8f43-3fb2fcf21b27</xsl:param> | 8 <xsl:param name="project-uuid">de3f3307-3429-4ff9-8f43-3fb2fcf21b27</xsl:param> |
9 <xsl:param name="render-checkboxes" select="true()"/> | 9 <xsl:param name="render-checkboxes" select="true()"/> |
10 <xsl:param name="callback"/> | 10 <xsl:param name="callback"/> |
11 | 11 |
12 <xsl:param name="locale">de</xsl:param> | |
13 | |
14 <xsl:decimal-format name="de" decimal-separator=',' grouping-separator='.'/> | |
15 <xsl:decimal-format name="en" decimal-separator='.' grouping-separator=','/> | |
16 | |
17 <!-- XXX: This kind of i18n is cheesy. | |
18 It should be better done in an external resource. --> | |
19 | |
20 <xsl:variable name="km-pattern"> | |
21 <xsl:choose> | |
22 <xsl:when test="$locale = 'de'">0,##</xsl:when> | |
23 <xsl:otherwise>0.##</xsl:otherwise> | |
24 </xsl:choose> | |
25 </xsl:variable> | |
26 | |
27 <xsl:variable name="i18n-event"> | |
28 <xsl:choose> | |
29 <xsl:when test="$locale = 'de'">Ereignis</xsl:when> | |
30 <xsl:otherwise>Event</xsl:otherwise> | |
31 </xsl:choose> | |
32 </xsl:variable> | |
33 | |
34 <xsl:variable name="i18n-legend"> | |
35 <xsl:choose> | |
36 <xsl:when test="$locale = 'de'">Legende</xsl:when> | |
37 <xsl:otherwise>Caption</xsl:otherwise> | |
38 </xsl:choose> | |
39 </xsl:variable> | |
40 | |
41 <xsl:variable name="i18n-color"> | |
42 <xsl:choose> | |
43 <xsl:when test="$locale = 'de'">Farbe</xsl:when> | |
44 <xsl:otherwise>Color</xsl:otherwise> | |
45 </xsl:choose> | |
46 </xsl:variable> | |
47 | |
48 <xsl:variable name="i18n-meaning"> | |
49 <xsl:choose> | |
50 <xsl:when test="$locale = 'de'">Bedeutung</xsl:when> | |
51 <xsl:otherwise>Meaning</xsl:otherwise> | |
52 </xsl:choose> | |
53 </xsl:variable> | |
54 | |
55 <xsl:variable name="i18n-around-mnq"> | |
56 <xsl:choose> | |
57 <xsl:when test="$locale = 'de'">um MNQ</xsl:when> | |
58 <xsl:otherwise>around MNQ</xsl:otherwise> | |
59 </xsl:choose> | |
60 </xsl:variable> | |
61 | |
62 <xsl:variable name="i18n-around-mq"> | |
63 <xsl:choose> | |
64 <xsl:when test="$locale = 'de'">um MQ</xsl:when> | |
65 <xsl:otherwise>around MQ</xsl:otherwise> | |
66 </xsl:choose> | |
67 </xsl:variable> | |
68 | |
69 <xsl:variable name="i18n-around-mhq"> | |
70 <xsl:choose> | |
71 <xsl:when test="$locale = 'de'">um MHQ</xsl:when> | |
72 <xsl:otherwise>around MHQ</xsl:otherwise> | |
73 </xsl:choose> | |
74 </xsl:variable> | |
75 | |
76 <xsl:variable name="i18n-above-hq5"> | |
77 <xsl:choose> | |
78 <xsl:when test="$locale = 'de'">über HQ5</xsl:when> | |
79 <xsl:otherwise>above HQ5</xsl:otherwise> | |
80 </xsl:choose> | |
81 </xsl:variable> | |
82 | |
83 <!-- TODO: Format dates according locale. --> | |
84 | |
12 <xsl:template match="@*" mode="min"> | 85 <xsl:template match="@*" mode="min"> |
13 <xsl:if test="position() = 1"> | 86 <xsl:if test="position() = 1"> |
14 <xsl:value-of select="number(.)"/> | 87 <xsl:value-of select="number(.)"/> |
15 </xsl:if> | 88 </xsl:if> |
16 </xsl:template> | 89 </xsl:template> |
21 </xsl:if> | 94 </xsl:if> |
22 </xsl:template> | 95 </xsl:template> |
23 | 96 |
24 <xsl:variable name="global-min"> | 97 <xsl:variable name="global-min"> |
25 <xsl:choose> | 98 <xsl:choose> |
26 <xsl:when test="count(/fixings/events/event) > 0"> | 99 <xsl:when test="count(/fixings/events/event/sector) > 0"> |
27 <xsl:apply-templates mode="min" select="/fixings/events/event/sector/@from"> | 100 <xsl:apply-templates mode="min" select="/fixings/events/event/sector/@from"> |
28 <xsl:sort data-type="number" select="."/> | 101 <xsl:sort data-type="number" select="."/> |
29 </xsl:apply-templates> | 102 </xsl:apply-templates> |
30 </xsl:when> | 103 </xsl:when> |
31 <xsl:otherwise> | 104 <xsl:otherwise> |
34 </xsl:choose> | 107 </xsl:choose> |
35 </xsl:variable> | 108 </xsl:variable> |
36 | 109 |
37 <xsl:variable name="global-max"> | 110 <xsl:variable name="global-max"> |
38 <xsl:choose> | 111 <xsl:choose> |
39 <xsl:when test="count(/fixings/events/event) > 0"> | 112 <xsl:when test="count(/fixings/events/event/sector) > 0"> |
40 <xsl:apply-templates mode="max" select="/fixings/events/event/sector/@to"> | 113 <xsl:apply-templates mode="max" select="/fixings/events/event/sector/@to"> |
41 <xsl:sort data-type="number" select="."/> | 114 <xsl:sort data-type="number" select="."/> |
42 </xsl:apply-templates> | 115 </xsl:apply-templates> |
43 </xsl:when> | 116 </xsl:when> |
44 <xsl:otherwise> | 117 <xsl:otherwise> |
163 <xsl:text>%</xsl:text> | 236 <xsl:text>%</xsl:text> |
164 <xsl:text>;float:left</xsl:text> | 237 <xsl:text>;float:left</xsl:text> |
165 </xsl:attribute> | 238 </xsl:attribute> |
166 <xsl:attribute name="title"> | 239 <xsl:attribute name="title"> |
167 <xsl:text>km </xsl:text> | 240 <xsl:text>km </xsl:text> |
168 <xsl:value-of select="@from"/> | 241 <xsl:value-of select="format-number(@from, $km-pattern, $locale)"/> |
169 <xsl:text> - </xsl:text> | 242 <xsl:text> - </xsl:text> |
170 <xsl:value-of select="@to"/> | 243 <xsl:value-of select="format-number(@to, $km-pattern, $locale)"/> |
171 <xsl:choose> | 244 <xsl:choose> |
172 <xsl:when test="@class = '0'"> / Q um MNQ</xsl:when> | 245 <xsl:when test="@class = '0'"> / Q <xsl:value-of select="$i18n-around-mnq"/></xsl:when> |
173 <xsl:when test="@class = '1'"> / Q um MQ</xsl:when> | 246 <xsl:when test="@class = '1'"> / Q <xsl:value-of select="$i18n-around-mq"/></xsl:when> |
174 <xsl:when test="@class = '2'"> / Q um MHQ</xsl:when> | 247 <xsl:when test="@class = '2'"> / Q <xsl:value-of select="$i18n-around-mhq"/></xsl:when> |
175 <xsl:when test="@class = '3'"> / Q über HQ5</xsl:when> | 248 <xsl:when test="@class = '3'"> / Q <xsl:value-of select="$i18n-above-hq5"/></xsl:when> |
176 </xsl:choose> | 249 </xsl:choose> |
177 </xsl:attribute> | 250 </xsl:attribute> |
178 <xsl:text disable-output-escaping="yes"><![CDATA[ ]]></xsl:text> | 251 <xsl:text disable-output-escaping="yes"><![CDATA[ ]]></xsl:text> |
179 </div> | 252 </div> |
180 </xsl:template> | 253 </xsl:template> |
203 <div> | 276 <div> |
204 <xsl:attribute name="style"> | 277 <xsl:attribute name="style"> |
205 <xsl:text>overflow:hidden;background:</xsl:text> | 278 <xsl:text>overflow:hidden;background:</xsl:text> |
206 <xsl:choose> | 279 <xsl:choose> |
207 <xsl:when test="(count(preceding::*) mod 2) = 0">#ada96e</xsl:when> | 280 <xsl:when test="(count(preceding::*) mod 2) = 0">#ada96e</xsl:when> |
208 <xsl:otherwise>gray</xsl:otherwise> | 281 <xsl:otherwise>silver</xsl:otherwise> |
209 </xsl:choose> | 282 </xsl:choose> |
210 <xsl:text>;width:</xsl:text> | 283 <xsl:text>;width:</xsl:text> |
211 <xsl:call-template name="percent"> | 284 <xsl:call-template name="percent"> |
212 <xsl:with-param name="sector" select="."/> | 285 <xsl:with-param name="sector" select="."/> |
213 </xsl:call-template> | 286 </xsl:call-template> |
215 <xsl:text>;float:left</xsl:text> | 288 <xsl:text>;float:left</xsl:text> |
216 </xsl:attribute> | 289 </xsl:attribute> |
217 <xsl:attribute name="title"> | 290 <xsl:attribute name="title"> |
218 <xsl:value-of select="@name"/> | 291 <xsl:value-of select="@name"/> |
219 <xsl:text>: km </xsl:text> | 292 <xsl:text>: km </xsl:text> |
220 <xsl:value-of select="@from"/> | 293 <xsl:value-of select="format-number(@from, $km-pattern, $locale)"/> |
221 <xsl:text> - </xsl:text> | 294 <xsl:text> - </xsl:text> |
222 <xsl:value-of select="@to"/> | 295 <xsl:value-of select="format-number(@to, $km-pattern, $locale)"/> |
223 </xsl:attribute> | 296 </xsl:attribute> |
224 <nobr><xsl:value-of select="@name"/></nobr> | 297 <nobr><xsl:value-of select="@name"/></nobr> |
225 </div> | 298 </div> |
226 </xsl:template> | 299 </xsl:template> |
227 | 300 |
238 <tr> | 311 <tr> |
239 <xsl:if test="$render-checkboxes"> | 312 <xsl:if test="$render-checkboxes"> |
240 <th> </th> | 313 <th> </th> |
241 </xsl:if> | 314 </xsl:if> |
242 <th><xsl:apply-templates mode="gauges" select="/fixings/gauges"/></th> | 315 <th><xsl:apply-templates mode="gauges" select="/fixings/gauges"/></th> |
243 <th>Ereignis</th> | 316 <th><xsl:value-of select="$i18n-event"/></th> |
244 </tr> | 317 </tr> |
245 <xsl:apply-templates/> | 318 <xsl:apply-templates/> |
246 </table> | 319 </table> |
247 </xsl:template> | 320 </xsl:template> |
248 | 321 |
249 <xsl:template match="/"> | 322 <xsl:template match="/"> |
250 <xsl:apply-templates/> | 323 <xsl:apply-templates/> |
251 <hr/> | 324 <hr/> |
252 <table border="1" cellspacing="0" cellpadding="0"> | 325 <table border="1" cellspacing="0" cellpadding="0"> |
253 <caption>Legende</caption> | 326 <caption><xsl:value-of select="$i18n-legend"/></caption> |
254 <tr> | 327 <tr> |
255 <th>Farbe</th> | 328 <th><xsl:value-of select="$i18n-color"/></th> |
256 <th colspan="2">Bedeutung</th> | 329 <th colspan="2"><xsl:value-of select="$i18n-meaning"/></th> |
257 </tr> | 330 </tr> |
258 <xsl:if test="count(/fixings/events/event/sector[@class = '0']) > 0"> | 331 <xsl:if test="count(/fixings/events/event/sector[@class = '0']) > 0"> |
259 <tr> | 332 <tr> |
260 <td style="background: green"> </td> | 333 <td style="background: green"> </td> |
261 <td>um MNQ</td> | 334 <td><xsl:value-of select="$i18n-around-mnq"/></td> |
262 <td>Q ∈ [0, (MNQ+MQ)/2)</td> | 335 <td>Q ∈ [0, (MNQ+MQ)/2)</td> |
263 </tr> | 336 </tr> |
264 </xsl:if> | 337 </xsl:if> |
265 <xsl:if test="count(/fixings/events/event/sector[@class = '1']) > 0"> | 338 <xsl:if test="count(/fixings/events/event/sector[@class = '1']) > 0"> |
266 <tr> | 339 <tr> |
267 <td style="background: blue"> </td> | 340 <td style="background: blue"> </td> |
268 <td>um MQ</td> | 341 <td><xsl:value-of select="$i18n-around-mq"/></td> |
269 <td>Q ∈ [(MNQ+MQ)/2, (MQ+MHQ)/2)</td> | 342 <td>Q ∈ [(MNQ+MQ)/2, (MQ+MHQ)/2)</td> |
270 </tr> | 343 </tr> |
271 </xsl:if> | 344 </xsl:if> |
272 <xsl:if test="count(/fixings/events/event/sector[@class = '2']) > 0"> | 345 <xsl:if test="count(/fixings/events/event/sector[@class = '2']) > 0"> |
273 <tr> | 346 <tr> |
274 <td style="background: magenta"> </td> | 347 <td style="background: magenta"> </td> |
275 <td>um MHQ</td> | 348 <td><xsl:value-of select="$i18n-around-mhq"/></td> |
276 <td>Q ∈ [(MQ+MHQ)/2, HQ5)</td> | 349 <td>Q ∈ [(MQ+MHQ)/2, HQ5)</td> |
277 </tr> | 350 </tr> |
278 </xsl:if> | 351 </xsl:if> |
279 <xsl:if test="count(/fixings/events/event/sector[@class = '3']) > 0"> | 352 <xsl:if test="count(/fixings/events/event/sector[@class = '3']) > 0"> |
280 <tr> | 353 <tr> |
281 <td style="background: red"> </td> | 354 <td style="background: red"> </td> |
282 <td>über HQ5</td> | 355 <td><xsl:value-of select="$i18n-above-hq5"/></td> |
283 <td>Q ∈ [HQ5, ∞)</td> | 356 <td>Q ∈ [HQ5, ∞)</td> |
284 </tr> | 357 </tr> |
285 </xsl:if> | 358 </xsl:if> |
286 </table> | 359 </table> |
287 </xsl:template> | 360 </xsl:template> |