Changeset 3596
- Timestamp:
- 2002-12-02T09:41:18+13:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/interfaces/default/transform/service-params.xsl
r3565 r3596 1 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 2 <xsl:stylesheet version="1.0" 3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 4 xmlns:java="http://xml.apache.org/xslt/java" 5 extension-element-prefixes="java"> 4 6 5 <!-- 6 <xsl:output method="html"/> 7 --> 8 <!-- handling of the different types of params on a service form --> 7 <!-- handling of the different types of params on a service form 8 - these now only output the selection box/text box etc, not the name --> 9 9 10 <!-- boolean params --> 10 <xsl:template match="param[@type='boolean']"> 11 <xsl:variable name="pname" select='@name'/> 12 <xsl:variable name='pdisplay' select='ancestor::service/display/param[@name=$pname]'/> 13 <td><xsl:value-of select='$pdisplay/name'/></td> 14 <td align='right'><select name='{@shortname}'> 15 <option value="0"><xsl:if test="@default='0'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select='$pdisplay/option[@name="0"]'/></option> 16 <option value="1"><xsl:if test="@default='1'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select='$pdisplay/option[@name="1"]'/></option> 17 </select> 18 </td> 19 </xsl:template> 11 <xsl:template match="param[@type='boolean']"> 12 <xsl:param name="default" select="@default"/> 13 <xsl:variable name="pname" select='@name'/> 14 <xsl:variable name='pdisplay' select='ancestor::service/display/param[@name=$pname]'/> 15 <select name='{@shortname}'> 16 <option value="0"><xsl:if test="$default='0'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select='$pdisplay/option[@name="0"]'/></option> 17 <option value="1"><xsl:if test="$default='1'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select='$pdisplay/option[@name="1"]'/></option> 18 </select> 19 </xsl:template> 20 21 <!-- integer params --> 22 <xsl:template match="param[@type='integer']"> 23 <xsl:param name="default" select="@default"/> 24 <input type="text" name="{@shortname}" size="3" value="{$default}"/> 25 </xsl:template> 20 26 21 <!-- integer params --> 22 <xsl:template match="param[@type='integer']"> 23 <xsl:variable name="pname" select='@name'/> 24 <td><xsl:value-of select='ancestor::service/display/param[@name=$pname]/name'/></td><td align='right'><input type="text" name="{@shortname}" size="3" value="{@default}"/></td> 25 </xsl:template> 26 27 <!-- single selection enum params --> 28 <xsl:template match="param[@type='enum_single']"> 29 <xsl:variable name="pname"><xsl:value-of select='@name'/></xsl:variable> 30 <xsl:variable name='pdisplay' select='ancestor::service/display/param[@name=$pname]'/> 31 <xsl:variable name="current"><xsl:value-of select="@default"/></xsl:variable> 32 <td><xsl:value-of select='$pdisplay/name'/></td> 33 <td align='right'><select name="{@shortname}"> 34 <xsl:for-each select="option"> 35 <xsl:variable name='op_name' select='@name'/> 36 <option value="{@name}"><xsl:if test="@name=$current"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select='$pdisplay/option[@name=$op_name]'/></option> 37 </xsl:for-each> 38 </select></td> 39 </xsl:template> 27 <!-- single selection enum params --> 28 <xsl:template match="param[@type='enum_single']"> 29 <xsl:param name="default" select="@default"/> 30 <xsl:variable name="pname"><xsl:value-of select='@name'/></xsl:variable> 31 <xsl:variable name='pdisplay' select='ancestor::service/display/param[@name=$pname]'/> 32 <xsl:variable name="current"><xsl:value-of select="$default"/></xsl:variable> 33 <select name="{@shortname}"> 34 <xsl:for-each select="option"> 35 <xsl:variable name='op_name' select='@name'/> 36 <option value="{@name}"><xsl:if test="@name=$current"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select='$pdisplay/option[@name=$op_name]'/></option> 37 </xsl:for-each> 38 </select> 39 </xsl:template> 40 40 41 41 42 <!-- multiple selection enum params -->43 <xsl:template match="param[@type='enum_multi']">44 <xsl:variable name="pname" select='@name'/>45 <xsl:variable name='pdisplay' select='ancestor::service/display/param[@name=$pname]'/>46 <td><xsl:value-of select='$pdisplay/name'/></td>47 <td align='right'><select name="{@shortname}" size='2'><xsl:attribute name="multiple"></xsl:attribute>48 <xsl:for-each select="option">49 50 51 </xsl:for-each>52 </select></td>53 </xsl:template>42 <!-- multiple selection enum params --> 43 <!-- how to do defaults for this?? --> 44 <xsl:template match="param[@type='enum_multi']"> 45 <xsl:variable name="pname" select='@name'/> 46 <xsl:variable name='pdisplay' select='ancestor::service/display/param[@name=$pname]'/> 47 <select name="{@shortname}" size='2'><xsl:attribute name="multiple"></xsl:attribute> 48 <xsl:for-each select="option"> 49 <xsl:variable name='op_name' select='@name'/> 50 <option value="{@name}"><xsl:value-of select='$pdisplay/option[@name=$op_name]'/></option> 51 </xsl:for-each> 52 </select> 53 </xsl:template> 54 54 55 <!-- string params --> 56 <xsl:template match="param[@type='string']"> 57 <xsl:variable name="pname" select='@name'/> 58 <td><xsl:value-of select='ancestor::service/display/param[@name=$pname]/name'/></td> 59 <td align='right'><input type="text" name="{@shortname}" size="50" value="{@default}"/></td> 60 </xsl:template> 55 <!-- string params --> 56 <xsl:template match="param[@type='string']"> 57 <xsl:param name="default" select="@default"/> 58 <xsl:variable name="pname" select='@name'/> 59 <input type="text" name="{@shortname}" size="50" value="{$default}"/> 60 </xsl:template> 61 62 <!-- multi params - params that are combinations of other params --> 63 <xsl:template match="param[@type='multi']"> 64 <xsl:variable name="parent" select="@name"/> 65 <table> 66 <tr><td colspan='10'><xsl:value-of select="ancestor::service/display/param[@name=$parent]/name"/></td></tr> 67 <tr> 68 <xsl:for-each select="param"> 69 <xsl:variable name='pname' select='@name'/> 70 <td><xsl:value-of select="ancestor::service/display/param[@name=$pname]/name"/></td> 71 </xsl:for-each> 72 </tr> 73 <xsl:apply-templates select="." mode="contents"><xsl:with-param name="occurs" select="@occurs"/></xsl:apply-templates> 74 </table> 75 </xsl:template> 76 77 <xsl:template match="param[@type='multi']" mode="contents"> 78 <xsl:param name="occurs">1</xsl:param> 79 <xsl:variable name="pos" select="@occurs - $occurs"/> 80 <xsl:choose> 81 <xsl:when test="default"> 82 <tr><xsl:for-each select="param"> 83 <td><xsl:if test="not(@ignore) or @ignore != $pos"> 84 <xsl:variable name="pname" select="@name"/> 85 <xsl:variable name="values"><xsl:value-of select="../default[@name=$pname]"/></xsl:variable> 86 <xsl:apply-templates select='.'><xsl:with-param name="default"><xsl:value-of select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($values, $occurs)"/></xsl:with-param></xsl:apply-templates> 87 </xsl:if></td> 88 </xsl:for-each></tr> 89 </xsl:when> 90 <xsl:otherwise> 91 <tr><xsl:for-each select="param"> 92 <td><xsl:if test="not(@ignore) or @ignore != $pos"> 93 <xsl:variable name="pname" select="@name"/> 94 <xsl:apply-templates select='.'/> 95 </xsl:if></td> 96 </xsl:for-each></tr> 97 </xsl:otherwise> 98 </xsl:choose> 99 <!-- recursively call this template to get multiple entries --> 100 <xsl:if test="$occurs > 1"> 101 <xsl:apply-templates select="." mode="contents"><xsl:with-param name="occurs" select="$occurs - 1"/></xsl:apply-templates> 102 </xsl:if> 103 </xsl:template> 104 105 61 106 </xsl:stylesheet>
Note:
See TracChangeset
for help on using the changeset viewer.