Mercurial > dive4elements > river
comparison flys-client/src/main/webapp/WEB-INF/stylesheets/fixoverview2html.xsl @ 2912:329db21372ba
FixA: Extent of overview is determined by min/max km of sectors.
flys-client/trunk@4733 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 20 Jun 2012 17:30:42 +0000 |
parents | 7715324132bf |
children | 6d96443ed6e6 |
comparison
equal
deleted
inserted
replaced
2911:37dce0f2f63b | 2912:329db21372ba |
---|---|
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:template match="@*" mode="min"> | |
13 <xsl:if test="position() = 1"> | |
14 <xsl:value-of select="number(.)"/> | |
15 </xsl:if> | |
16 </xsl:template> | |
17 | |
18 <xsl:template match="@*" mode="max"> | |
19 <xsl:if test="position() = last()"> | |
20 <xsl:value-of select="number(.)"/> | |
21 </xsl:if> | |
22 </xsl:template> | |
23 | |
24 <xsl:variable name="events-min"> | |
25 <xsl:choose> | |
26 <xsl:when test="count(/fixings/events/event/sector) > 0"> | |
27 <xsl:apply-templates mode="min" select="/fixings/events/event/sector/@from"> | |
28 <xsl:sort data-type="number" select="."/> | |
29 </xsl:apply-templates> | |
30 </xsl:when> | |
31 <xsl:otherwise> | |
32 <xsl:value-of select="number(/fixings/river/@from)"/> | |
33 </xsl:otherwise> | |
34 </xsl:choose> | |
35 </xsl:variable> | |
36 | |
37 <xsl:variable name="events-max"> | |
38 <xsl:choose> | |
39 <xsl:when test="count(/fixings/events/event/sector) > 0"> | |
40 <xsl:apply-templates mode="max" select="/fixings/events/event/sector/@to"> | |
41 <xsl:sort data-type="number" select="."/> | |
42 </xsl:apply-templates> | |
43 </xsl:when> | |
44 <xsl:otherwise> | |
45 <xsl:value-of select="number(/fixings/river/@to)"/> | |
46 </xsl:otherwise> | |
47 </xsl:choose> | |
48 </xsl:variable> | |
49 | |
12 <xsl:template name="percent"> | 50 <xsl:template name="percent"> |
13 <xsl:param name="sector"/> | 51 <xsl:param name="sector"/> |
14 <xsl:variable name="rfrom" select="number(/fixings/river/@from)"/> | 52 <xsl:variable name="rfrom" select="number($events-min)"/> |
15 <xsl:variable name="rto" select="number(/fixings/river/@to)"/> | 53 <xsl:variable name="rto" select="number($events-max)"/> |
16 <xsl:variable name="rlength" select="$rto - $rfrom"/> | 54 <xsl:variable name="rlength" select="$rto - $rfrom"/> |
17 | 55 |
18 <xsl:variable name="sfrom" select="number($sector/@from)"/> | 56 <xsl:variable name="sfrom" select="number($sector/@from)"/> |
19 <xsl:variable name="sto" select="number($sector/@to)"/> | 57 <xsl:variable name="sto" select="number($sector/@to)"/> |
20 <xsl:variable name="slength" select="$sto - $sfrom"/> | 58 <xsl:variable name="slength" select="$sto - $sfrom"/> |
26 <xsl:variable name="preds" select="$sector/preceding-sibling::sector"/> | 64 <xsl:variable name="preds" select="$sector/preceding-sibling::sector"/> |
27 <xsl:variable name="num-preds" select="count($preds)"/> | 65 <xsl:variable name="num-preds" select="count($preds)"/> |
28 <xsl:variable name="glength"> | 66 <xsl:variable name="glength"> |
29 <xsl:choose> | 67 <xsl:choose> |
30 <xsl:when test="$num-preds < 1"> | 68 <xsl:when test="$num-preds < 1"> |
31 <xsl:variable name="rfrom" select="number(/fixings/river/@from)"/> | 69 <xsl:variable name="rfrom" select="number($events-min)"/> |
32 <xsl:value-of select="number($sector/@from) - $rfrom"/> | 70 <xsl:value-of select="number($sector/@from) - $rfrom"/> |
33 </xsl:when> | 71 </xsl:when> |
34 <xsl:otherwise> | 72 <xsl:otherwise> |
35 <xsl:variable name="bend" select="number($preds[last()]/@to)"/> | 73 <xsl:variable name="bend" select="number($preds[last()]/@to)"/> |
36 <xsl:value-of select="number($sector/@from) - $bend"/> | 74 <xsl:value-of select="number($sector/@from) - $bend"/> |
41 <xsl:when test="number($glength) < 0.05 "/> | 79 <xsl:when test="number($glength) < 0.05 "/> |
42 <xsl:otherwise> | 80 <xsl:otherwise> |
43 <div> | 81 <div> |
44 <xsl:attribute name="style"> | 82 <xsl:attribute name="style"> |
45 <xsl:text>width:</xsl:text> | 83 <xsl:text>width:</xsl:text> |
46 <xsl:variable name="rfrom" select="number(/fixings/river/@from)"/> | 84 <xsl:variable name="rfrom" select="number($events-min)"/> |
47 <xsl:variable name="rto" select="number(/fixings/river/@to)"/> | 85 <xsl:variable name="rto" select="number($events-max)"/> |
48 <xsl:variable name="rlength" select="$rto - $rfrom"/> | 86 <xsl:variable name="rlength" select="$rto - $rfrom"/> |
49 <xsl:value-of select="100.0 * ($glength div $rlength)"/> | 87 <xsl:value-of select="100.0 * ($glength div $rlength)"/> |
50 <xsl:text>%;float:left</xsl:text> | 88 <xsl:text>%;float:left</xsl:text> |
51 </xsl:attribute> | 89 </xsl:attribute> |
52 <xsl:text disable-output-escaping="yes"><![CDATA[ ]]></xsl:text> | 90 <xsl:text disable-output-escaping="yes"><![CDATA[ ]]></xsl:text> |
117 <col width="20px"/> | 155 <col width="20px"/> |
118 </xsl:if> | 156 </xsl:if> |
119 <col width="*"/> | 157 <col width="*"/> |
120 <col width="90px"/> | 158 <col width="90px"/> |
121 </colgroup> | 159 </colgroup> |
160 <tr> | |
161 <th>km <xsl:value-of select="$events-min"/> - <xsl:value-of select="$events-max"/></th> | |
162 <th>Ereignis</th> | |
163 </tr> | |
122 <xsl:apply-templates/> | 164 <xsl:apply-templates/> |
123 </table> | 165 </table> |
124 </xsl:template> | 166 </xsl:template> |
125 | 167 |
126 <xsl:template match="/"> | 168 <xsl:template match="/"> |