diff flys-artifacts/contrib/fixoverview2html.xsl @ 3433:c3fb41e73ffb

FixA: Overview: Clip the displayed from/to ranges of the gauges to the max extent of the events. flys-artifacts/trunk@5094 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sat, 21 Jul 2012 17:59:13 +0000
parents 9c39a25aa849
children
line wrap: on
line diff
--- a/flys-artifacts/contrib/fixoverview2html.xsl	Sat Jul 21 12:50:48 2012 +0000
+++ b/flys-artifacts/contrib/fixoverview2html.xsl	Sat Jul 21 17:59:13 2012 +0000
@@ -276,10 +276,32 @@
       <xsl:with-param name="gauge" select="."/>
     </xsl:call-template>
     <div>
+      <xsl:variable name="start">
+        <xsl:choose>
+          <xsl:when test="number(@from) &lt; $global-min">
+            <xsl:value-of select="$global-min"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="number(@from)"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+
+      <xsl:variable name="end">
+        <xsl:choose>
+          <xsl:when test="number(@to) &gt; $global-max">
+            <xsl:value-of select="$global-max"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="number(@to)"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+
       <xsl:attribute name="style">
         <xsl:text>overflow:hidden;background:</xsl:text>
         <xsl:choose>
-          <xsl:when test="(count(preceding::*) mod  2) = 0">#ada96e</xsl:when>
+          <xsl:when test="(count(preceding::*) mod 2) = 0">#ada96e</xsl:when>
           <xsl:otherwise>silver</xsl:otherwise>
         </xsl:choose>
         <xsl:text>;width:</xsl:text>
@@ -292,9 +314,9 @@
       <xsl:attribute name="title">
         <xsl:value-of select="@name"/>
         <xsl:text>: km </xsl:text>
-        <xsl:value-of select="format-number(@from, $km-pattern, $locale)"/>
+        <xsl:value-of select="format-number($start, $km-pattern, $locale)"/>
         <xsl:text> - </xsl:text>
-        <xsl:value-of select="format-number(@to, $km-pattern, $locale)"/>
+        <xsl:value-of select="format-number($end, $km-pattern, $locale)"/>
       </xsl:attribute>
       <nobr><xsl:value-of select="@name"/></nobr>
     </div>

http://dive4elements.wald.intevation.org