diff gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl @ 577:60caaa265e2b

Render a matrix for measurement selection (measurement-parameter). gnv/trunk@714 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 26 Feb 2010 13:54:47 +0000
parents 59c6c7b62e43
children 97d90e314af5
line wrap: on
line diff
--- a/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl	Thu Feb 25 08:18:41 2010 +0000
+++ b/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl	Fri Feb 26 13:54:47 2010 +0000
@@ -73,14 +73,69 @@
 
 
     <xsl:template match="xform:group">
+        <xsl:variable name="selectcount" select="count(xform:select)"/>
+
         <legend>
             <xsl:value-of select="xform:label"/>
         </legend>
-        <table class="dynamic">
-            <xsl:apply-templates/>
+
+        <xsl:choose>
+            <xsl:when test="$selectcount &lt; '2'">
+                <table class="dynamic">
+                    <xsl:apply-templates/>
+                </table>
+            </xsl:when>
+            <xsl:otherwise>
+                <table class="static">
+                    <tr>
+                        <td><!-- nothing here --></td>
+                        <xsl:for-each select="xform:select[1]/xform:item">
+                            <td class="matrixHeader"><xsl:value-of select="position()"/>.</td>
+                        </xsl:for-each>
+                    </tr>
+                    <xsl:apply-templates mode="matrix" />
+                </table>
+                <xsl:apply-templates select="xform:select[1]" mode="matrixLegend"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+    <!-- template for rendering parameter matrix -->
+    <xsl:template match="xform:select" mode="matrix">
+        <tr>
+            <td><xsl:value-of select="@label" /></td>
+            <xsl:apply-templates mode="matrix" />
+        </tr>
+    </xsl:template>
+
+    <!-- template for rendering parameter matrix -->
+    <xsl:template match="xform:select" mode="matrixLegend">
+        <table>
+            <xsl:for-each select="xform:item">
+                <tr>
+                    <td><xsl:value-of select="position()" />.:</td>
+                    <td><xsl:value-of select="@parameter" /></td>
+                </tr>
+            </xsl:for-each>
         </table>
     </xsl:template>
 
+    <!-- template for rendering parameter matrix -->
+    <xsl:template match="xform:item" mode="matrix">
+        <xsl:variable name="value" select="xform:value/text()"/>
+        <xsl:variable name="name" select="@ref"/>
+        <td>
+            <xsl:choose>
+            <xsl:when test="@disabled = 'true'">
+                <input type="checkbox" name="{$name}" value="{$value}" disabled="true"></input>
+            </xsl:when>
+            <xsl:otherwise>
+                <input type="checkbox" name="{$name}" value="{$value}"></input>
+            </xsl:otherwise>
+            </xsl:choose>
+        </td>
+    </xsl:template>
+
 
     <xsl:template match="xform:input">
         <xsl:variable name="inputValue" select="xform:value"/>

http://dive4elements.wald.intevation.org