changeset 3427:5f47e68a1130

FixA: Bring XSLT in sync with flys-client to ease development. flys-artifacts/trunk@5084 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 20 Jul 2012 09:43:55 +0000 (2012-07-20)
parents e7a67407dea1
children 842b7b635701
files flys-artifacts/ChangeLog flys-artifacts/contrib/fixoverview2html.xsl
diffstat 2 files changed, 105 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Jul 20 09:34:47 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Jul 20 09:43:55 2012 +0000
@@ -1,3 +1,9 @@
+2012-07-20	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* contrib/fixoverview2html.xsl: To help developing the 
+	  HTML overview stylsheet more quickly bring back in sync with
+	  version of the flys-client.
+
 2012-07-20  Ingo Weinzierl <ingo@intevation.de>
 
 	* doc/conf/artifacts/minfo.xml: Changed the parameters for SQ relation
--- a/flys-artifacts/contrib/fixoverview2html.xsl	Fri Jul 20 09:34:47 2012 +0000
+++ b/flys-artifacts/contrib/fixoverview2html.xsl	Fri Jul 20 09:43:55 2012 +0000
@@ -9,11 +9,50 @@
 
   <xsl:param name="project-uuid">de3f3307-3429-4ff9-8f43-3fb2fcf21b27</xsl:param>
   <xsl:param name="render-checkboxes" select="true()"/>
+  <xsl:param name="callback"/>
+
+  <xsl:template match="@*" mode="min">
+    <xsl:if test="position() = 1">
+      <xsl:value-of select="number(.)"/>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="@*" mode="max">
+    <xsl:if test="position() = last()">
+      <xsl:value-of select="number(.)"/>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:variable name="events-min">
+    <xsl:choose>
+      <xsl:when test="count(/fixings/events/event/sector) &gt; 0">
+        <xsl:apply-templates mode="min" select="/fixings/events/event/sector/@from">
+          <xsl:sort data-type="number" select="."/>
+        </xsl:apply-templates>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="number(/fixings/river/@from)"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="events-max">
+    <xsl:choose>
+      <xsl:when test="count(/fixings/events/event/sector) &gt; 0">
+        <xsl:apply-templates mode="max" select="/fixings/events/event/sector/@to">
+          <xsl:sort data-type="number" select="."/>
+        </xsl:apply-templates>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="number(/fixings/river/@to)"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
 
   <xsl:template name="percent">
     <xsl:param name="sector"/>
-    <xsl:variable name="rfrom" select="number(/fixings/river/@from)"/>
-    <xsl:variable name="rto" select="number(/fixings/river/@to)"/>
+    <xsl:variable name="rfrom" select="number($events-min)"/>
+    <xsl:variable name="rto" select="number($events-max)"/>
     <xsl:variable name="rlength" select="$rto - $rfrom"/>
 
     <xsl:variable name="sfrom" select="number($sector/@from)"/>
@@ -29,7 +68,7 @@
     <xsl:variable name="glength">
       <xsl:choose>
         <xsl:when test="$num-preds &lt; 1">
-          <xsl:variable name="rfrom" select="number(/fixings/river/@from)"/>
+          <xsl:variable name="rfrom" select="number($events-min)"/>
           <xsl:value-of select="number($sector/@from) - $rfrom"/>
         </xsl:when>
         <xsl:otherwise>
@@ -44,8 +83,8 @@
         <div>
           <xsl:attribute name="style">
             <xsl:text>width:</xsl:text>
-              <xsl:variable name="rfrom" select="number(/fixings/river/@from)"/>
-              <xsl:variable name="rto" select="number(/fixings/river/@to)"/>
+              <xsl:variable name="rfrom" select="number($events-min)"/>
+              <xsl:variable name="rto" select="number($events-max)"/>
               <xsl:variable name="rlength" select="$rto - $rfrom"/>
               <xsl:value-of select="100.0 * ($glength div $rlength)"/>
             <xsl:text>%;float:left</xsl:text>
@@ -82,16 +121,22 @@
         <xsl:value-of select="@from"/>
         <xsl:text> - </xsl:text>
         <xsl:value-of select="@to"/>
+        <xsl:choose>
+          <xsl:when test="@class = '0'"> / Q um MNQ</xsl:when>
+          <xsl:when test="@class = '1'"> / Q um MQ</xsl:when>
+          <xsl:when test="@class = '2'"> / Q um MHQ</xsl:when>
+          <xsl:when test="@class = '3'"> / Q über HQ5</xsl:when>
+        </xsl:choose>
       </xsl:attribute>
       <xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text>
     </div>
   </xsl:template>
 
   <xsl:template match="event">
-    <tr>
+    <tr id="{@cid}">
       <xsl:if test="$render-checkboxes">
         <td>
-          <input type="checkbox" name="{$project-uuid}:{@cid}"/>
+          <input type="checkbox" name="{$project-uuid}:{@cid}" checked="true" onclick="{$callback}"/>
         </td>
       </xsl:if>
       <td>
@@ -105,14 +150,22 @@
   </xsl:template>
 
   <xsl:template match="events">
-    <table width="95%" border="1" cellspacing="0" cellpadding="0" style="font-size: 11pt;font-family:Arial;Verdana,sans-serif">
+    <table width="97%" border="1" cellspacing="0" cellpadding="0"
+           style="font-size: 10pt;font-family:Arial;Verdana,sans-serif">
       <colgroup>
         <xsl:if test="$render-checkboxes">
-            <col width="1em"/>
+            <col width="20px"/>
         </xsl:if>
         <col width="*"/>
-        <col width="11em"/>
+        <col width="75px"/>
       </colgroup>
+      <tr>
+        <xsl:if test="$render-checkboxes">
+          <th>&#160;</th>
+        </xsl:if>
+        <th>km <xsl:value-of select="$events-min"/> - <xsl:value-of select="$events-max"/></th>
+        <th>Ereignis</th>
+      </tr>
       <xsl:apply-templates/>
     </table>
   </xsl:template>
@@ -124,6 +177,42 @@
       </head>
       <body>
         <xsl:apply-templates/>
+        <hr/>
+        <table border="1" cellspacing="0" cellpadding="0">
+          <caption>Legende</caption>
+          <tr>
+            <th>Farbe</th>
+            <th colspan="2">Bedeutung</th>
+          </tr>
+          <xsl:if test="count(/fixings/events/event/sector[@class = '0']) &gt; 0">
+          <tr>
+            <td style="background: green">&#160;</td>
+            <td>um MNQ</td>
+            <td>Q &#8712; [0, (MNQ+MQ)/2)</td>
+          </tr>
+          </xsl:if>
+          <xsl:if test="count(/fixings/events/event/sector[@class = '1']) &gt; 0">
+          <tr>
+            <td style="background: blue">&#160;</td>
+            <td>um MQ</td>
+            <td>Q &#8712; [(MNQ+MQ)/2, (MQ+MHQ)/2)</td>
+          </tr>
+          </xsl:if>
+          <xsl:if test="count(/fixings/events/event/sector[@class = '2']) &gt; 0">
+          <tr>
+            <td style="background: magenta">&#160;</td>
+            <td>um MHQ</td>
+            <td>Q &#8712; [(MQ+MHQ)/2, HQ5)</td>
+          </tr>
+          </xsl:if>
+          <xsl:if test="count(/fixings/events/event/sector[@class = '3']) &gt; 0">
+          <tr>
+            <td style="background: red">&#160;</td>
+            <td>über HQ5</td>
+            <td>Q &#8712; [HQ5, &#8734;)</td>
+          </tr>
+          </xsl:if>
+        </table>
       </body>
     </html>
   </xsl:template>

http://dive4elements.wald.intevation.org