comparison gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl @ 414:59c6c7b62e43

Automatically select entry in multi select boxes if there is only one entry to avoid input failures. gnv/trunk@636 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 27 Jan 2010 13:26:02 +0000
parents 0ce07c6e132c
children 60caaa265e2b
comparison
equal deleted inserted replaced
413:0ce07c6e132c 414:59c6c7b62e43
24 <xsl:variable name="selectName" select="@ref"/> 24 <xsl:variable name="selectName" select="@ref"/>
25 <xsl:variable name="items" select="count(//xform:item)"/> 25 <xsl:variable name="items" select="count(//xform:item)"/>
26 26
27 <legend><xsl:value-of select="xform:label"/></legend> 27 <legend><xsl:value-of select="xform:label"/></legend>
28 <xsl:choose> 28 <xsl:choose>
29 <xsl:when test="$items = 1">
30 <select name="{$selectName}" multiple="multiple" size="{$items}">
31 <xsl:apply-templates mode="selected"/>
32 </select>
33 </xsl:when>
29 <xsl:when test="$items &lt; 5"> 34 <xsl:when test="$items &lt; 5">
30 <select name="{$selectName}" multiple="multiple" size="{$items}"> 35 <select name="{$selectName}" multiple="multiple" size="{$items}">
31 <xsl:apply-templates/> 36 <xsl:apply-templates/>
32 </select> 37 </select>
33 </xsl:when> 38 </xsl:when>
54 <xsl:value-of select="xform:label"/> 59 <xsl:value-of select="xform:label"/>
55 </option> 60 </option>
56 </xsl:otherwise> 61 </xsl:otherwise>
57 </xsl:choose> 62 </xsl:choose>
58 </xsl:template> 63 </xsl:template>
64
65
66 <xsl:template match="xform:item" mode="selected">
67 <xsl:variable name="optionValue" select="xform:value"/>
68 <option value="{$optionValue}" selected="selected">
69 <xsl:value-of select="xform:label"/>
70 </option>
71 </xsl:template>
72
59 73
60 74
61 <xsl:template match="xform:group"> 75 <xsl:template match="xform:group">
62 <legend> 76 <legend>
63 <xsl:value-of select="xform:label"/> 77 <xsl:value-of select="xform:label"/>

http://dive4elements.wald.intevation.org