Mercurial > dive4elements > river
comparison flys-client/src/main/webapp/WEB-INF/stylesheets/fixoverview2html.xsl @ 3375:87c0a06743b8
FixA: Overview contains names of the the gauges in the headline.
flys-client/trunk@5089 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 20 Jul 2012 14:09:53 +0000 |
parents | 89df168f289c |
children | 653dd9d7f5d5 |
comparison
equal
deleted
inserted
replaced
3374:27e455487d66 | 3375:87c0a06743b8 |
---|---|
19 <xsl:if test="position() = last()"> | 19 <xsl:if test="position() = last()"> |
20 <xsl:value-of select="number(.)"/> | 20 <xsl:value-of select="number(.)"/> |
21 </xsl:if> | 21 </xsl:if> |
22 </xsl:template> | 22 </xsl:template> |
23 | 23 |
24 <xsl:variable name="events-min"> | 24 <xsl:variable name="global-min"> |
25 <xsl:choose> | 25 <xsl:choose> |
26 <xsl:when test="count(/fixings/events/event/sector) > 0"> | 26 <xsl:when test="count(/fixings/events/event) > 0"> |
27 <xsl:apply-templates mode="min" select="/fixings/events/event/sector/@from"> | 27 <xsl:apply-templates mode="min" select="/fixings/events/event/sector/@from"> |
28 <xsl:sort data-type="number" select="."/> | 28 <xsl:sort data-type="number" select="."/> |
29 </xsl:apply-templates> | 29 </xsl:apply-templates> |
30 </xsl:when> | 30 </xsl:when> |
31 <xsl:otherwise> | 31 <xsl:otherwise> |
32 <xsl:value-of select="number(/fixings/river/@from)"/> | 32 <xsl:value-of select="number(/fixings/river/@from)"/> |
33 </xsl:otherwise> | 33 </xsl:otherwise> |
34 </xsl:choose> | 34 </xsl:choose> |
35 </xsl:variable> | 35 </xsl:variable> |
36 | 36 |
37 <xsl:variable name="events-max"> | 37 <xsl:variable name="global-max"> |
38 <xsl:choose> | 38 <xsl:choose> |
39 <xsl:when test="count(/fixings/events/event/sector) > 0"> | 39 <xsl:when test="count(/fixings/events/event) > 0"> |
40 <xsl:apply-templates mode="max" select="/fixings/events/event/sector/@to"> | 40 <xsl:apply-templates mode="max" select="/fixings/events/event/sector/@to"> |
41 <xsl:sort data-type="number" select="."/> | 41 <xsl:sort data-type="number" select="."/> |
42 </xsl:apply-templates> | 42 </xsl:apply-templates> |
43 </xsl:when> | 43 </xsl:when> |
44 <xsl:otherwise> | 44 <xsl:otherwise> |
47 </xsl:choose> | 47 </xsl:choose> |
48 </xsl:variable> | 48 </xsl:variable> |
49 | 49 |
50 <xsl:template name="percent"> | 50 <xsl:template name="percent"> |
51 <xsl:param name="sector"/> | 51 <xsl:param name="sector"/> |
52 <xsl:variable name="rfrom" select="number($events-min)"/> | 52 |
53 <xsl:variable name="rto" select="number($events-max)"/> | 53 <xsl:variable name="start"> |
54 <xsl:variable name="rlength" select="$rto - $rfrom"/> | |
55 | |
56 <xsl:variable name="sfrom" select="number($sector/@from)"/> | |
57 <xsl:variable name="sto" select="number($sector/@to)"/> | |
58 <xsl:variable name="slength" select="$sto - $sfrom"/> | |
59 <xsl:value-of select="100.0 * ($slength div $rlength)"/> | |
60 </xsl:template> | |
61 | |
62 <xsl:template name="emit-gap"> | |
63 <xsl:param name="sector"/> | |
64 <xsl:variable name="preds" select="$sector/preceding-sibling::sector"/> | |
65 <xsl:variable name="num-preds" select="count($preds)"/> | |
66 <xsl:variable name="glength"> | |
67 <xsl:choose> | 54 <xsl:choose> |
68 <xsl:when test="$num-preds < 1"> | 55 <xsl:when test="number($sector/@from) < $global-min"> |
69 <xsl:variable name="rfrom" select="number($events-min)"/> | 56 <xsl:value-of select="$global-min"/> |
70 <xsl:value-of select="number($sector/@from) - $rfrom"/> | |
71 </xsl:when> | 57 </xsl:when> |
72 <xsl:otherwise> | 58 <xsl:otherwise> |
73 <xsl:variable name="bend" select="number($preds[last()]/@to)"/> | 59 <xsl:value-of select="number($sector/@from)"/> |
74 <xsl:value-of select="number($sector/@from) - $bend"/> | |
75 </xsl:otherwise> | 60 </xsl:otherwise> |
76 </xsl:choose> | 61 </xsl:choose> |
77 </xsl:variable> | 62 </xsl:variable> |
63 | |
64 <xsl:variable name="end"> | |
65 <xsl:choose> | |
66 <xsl:when test="number($sector/@to) > $global-max"> | |
67 <xsl:value-of select="$global-max"/> | |
68 </xsl:when> | |
69 <xsl:otherwise> | |
70 <xsl:value-of select="number($sector/@to)"/> | |
71 </xsl:otherwise> | |
72 </xsl:choose> | |
73 </xsl:variable> | |
74 | |
78 <xsl:choose> | 75 <xsl:choose> |
79 <xsl:when test="number($glength) < 0.05 "/> | 76 <xsl:when test="$end < $start"> |
77 <xsl:value-of select="number(0)"/> | |
78 </xsl:when> | |
80 <xsl:otherwise> | 79 <xsl:otherwise> |
81 <div> | 80 <xsl:value-of select="100.0 * (($end - $start) div ($global-max - $global-min))"/> |
82 <xsl:attribute name="style"> | |
83 <xsl:text>width:</xsl:text> | |
84 <xsl:variable name="rfrom" select="number($events-min)"/> | |
85 <xsl:variable name="rto" select="number($events-max)"/> | |
86 <xsl:variable name="rlength" select="$rto - $rfrom"/> | |
87 <xsl:value-of select="100.0 * ($glength div $rlength)"/> | |
88 <xsl:text>%;float:left</xsl:text> | |
89 </xsl:attribute> | |
90 <xsl:text disable-output-escaping="yes"><![CDATA[ ]]></xsl:text> | |
91 </div> | |
92 </xsl:otherwise> | 81 </xsl:otherwise> |
93 </xsl:choose> | 82 </xsl:choose> |
83 </xsl:template> | |
84 | |
85 <xsl:template name="emit-gap-gauge"> | |
86 <xsl:param name="gauge"/> | |
87 <xsl:call-template name="internal-emit-gap"> | |
88 <xsl:with-param name="sector" select="$gauge"/> | |
89 <xsl:with-param name="preds" select="$gauge/preceding-sibling::gauge"/> | |
90 </xsl:call-template> | |
91 </xsl:template> | |
92 | |
93 <xsl:template name="emit-gap"> | |
94 <xsl:param name="sector"/> | |
95 <xsl:call-template name="internal-emit-gap"> | |
96 <xsl:with-param name="sector" select="$sector"/> | |
97 <xsl:with-param name="preds" select="$sector/preceding-sibling::sector"/> | |
98 </xsl:call-template> | |
99 </xsl:template> | |
100 | |
101 <xsl:template name="internal-emit-gap"> | |
102 <xsl:param name="sector"/> | |
103 <xsl:param name="preds"/> | |
104 | |
105 <xsl:variable name="start"> | |
106 <xsl:choose> | |
107 <xsl:when test="number($sector/@from) < $global-min"> | |
108 <xsl:value-of select="$global-min"/> | |
109 </xsl:when> | |
110 <xsl:otherwise> | |
111 <xsl:value-of select="$sector/@from"/> | |
112 </xsl:otherwise> | |
113 </xsl:choose> | |
114 </xsl:variable> | |
115 | |
116 <xsl:if test="$start < $global-max"> | |
117 <xsl:variable name="num-preds" select="count($preds)"/> | |
118 <xsl:variable name="prev-end"> | |
119 <xsl:choose> | |
120 <xsl:when test="count($preds) < 1"> | |
121 <xsl:value-of select="$global-min"/> | |
122 </xsl:when> | |
123 <xsl:otherwise> | |
124 <xsl:value-of select="number($preds[last()]/@to)"/> | |
125 </xsl:otherwise> | |
126 </xsl:choose> | |
127 </xsl:variable> | |
128 | |
129 <xsl:if test="$prev-end < $global-max"> | |
130 <xsl:variable name="gap-len" select="$start - $prev-end"/> | |
131 <xsl:if test="$gap-len > 0.005"> | |
132 <div> | |
133 <xsl:attribute name="style"> | |
134 <xsl:text>width:</xsl:text> | |
135 <xsl:value-of select="100.0 * ($gap-len div ($global-max - $global-min))"/> | |
136 <xsl:text>%;float:left</xsl:text> | |
137 </xsl:attribute> | |
138 <xsl:text disable-output-escaping="yes"><![CDATA[ ]]></xsl:text> | |
139 </div> | |
140 </xsl:if> | |
141 </xsl:if> | |
142 </xsl:if> | |
94 </xsl:template> | 143 </xsl:template> |
95 | 144 |
96 <xsl:template match="sector" mode="sectors"> | 145 <xsl:template match="sector" mode="sectors"> |
97 <xsl:call-template name="emit-gap"> | 146 <xsl:call-template name="emit-gap"> |
98 <xsl:with-param name="sector" select="."/> | 147 <xsl:with-param name="sector" select="."/> |
143 <td align="center"> | 192 <td align="center"> |
144 <xsl:attribute name="title"><xsl:value-of select="@description"/></xsl:attribute> | 193 <xsl:attribute name="title"><xsl:value-of select="@description"/></xsl:attribute> |
145 <xsl:value-of select="@date"/> | 194 <xsl:value-of select="@date"/> |
146 </td> | 195 </td> |
147 </tr> | 196 </tr> |
197 </xsl:template> | |
198 | |
199 <xsl:template match="gauge" mode="gauges"> | |
200 <xsl:call-template name="emit-gap-gauge"> | |
201 <xsl:with-param name="gauge" select="."/> | |
202 </xsl:call-template> | |
203 <div> | |
204 <xsl:attribute name="style"> | |
205 <xsl:text>overflow:hidden;background:</xsl:text> | |
206 <xsl:choose> | |
207 <xsl:when test="(count(preceding::*) mod 2) = 0">#ada96e</xsl:when> | |
208 <xsl:otherwise>gray</xsl:otherwise> | |
209 </xsl:choose> | |
210 <xsl:text>;width:</xsl:text> | |
211 <xsl:call-template name="percent"> | |
212 <xsl:with-param name="sector" select="."/> | |
213 </xsl:call-template> | |
214 <xsl:text>%</xsl:text> | |
215 <xsl:text>;float:left</xsl:text> | |
216 </xsl:attribute> | |
217 <xsl:attribute name="title"> | |
218 <xsl:value-of select="@name"/> | |
219 <xsl:text>: km </xsl:text> | |
220 <xsl:value-of select="@from"/> | |
221 <xsl:text> - </xsl:text> | |
222 <xsl:value-of select="@to"/> | |
223 </xsl:attribute> | |
224 <nobr><xsl:value-of select="@name"/></nobr> | |
225 </div> | |
148 </xsl:template> | 226 </xsl:template> |
149 | 227 |
150 <xsl:template match="events"> | 228 <xsl:template match="events"> |
151 <table width="97%" border="1" cellspacing="0" cellpadding="0" | 229 <table width="97%" border="1" cellspacing="0" cellpadding="0" |
152 style="font-size: 10pt;font-family:Arial;Verdana,sans-serif"> | 230 style="font-size: 10pt;font-family:Arial;Verdana,sans-serif"> |
159 </colgroup> | 237 </colgroup> |
160 <tr> | 238 <tr> |
161 <xsl:if test="$render-checkboxes"> | 239 <xsl:if test="$render-checkboxes"> |
162 <th> </th> | 240 <th> </th> |
163 </xsl:if> | 241 </xsl:if> |
164 <th>km <xsl:value-of select="$events-min"/> - <xsl:value-of select="$events-max"/></th> | 242 <th><xsl:apply-templates mode="gauges" select="/fixings/gauges"/></th> |
165 <th>Ereignis</th> | 243 <th>Ereignis</th> |
166 </tr> | 244 </tr> |
167 <xsl:apply-templates/> | 245 <xsl:apply-templates/> |
168 </table> | 246 </table> |
169 </xsl:template> | 247 </xsl:template> |
208 </table> | 286 </table> |
209 </xsl:template> | 287 </xsl:template> |
210 | 288 |
211 <xsl:template match="text()"/> | 289 <xsl:template match="text()"/> |
212 <xsl:template match="text()" mode="sectors"/> | 290 <xsl:template match="text()" mode="sectors"/> |
291 <xsl:template match="text()" mode="gauges"/> | |
213 | 292 |
214 </xsl:stylesheet> | 293 </xsl:stylesheet> |