Hello,
I've this template which fill up a combo box by the .xml file results but my problem that I always get just the firs result from the .xml file.
<xsl:template match="listdata/vatlist">
<select class="bodydisplaytext" name="vat">
<xsl:if test="count/Response/listdata/vatlist/Code) > 1">
<option value="">ALL</option>
</xsl:if>
<xsl:for-each select="/Response/listdata/vatlist/Code">
<xsl:variable name="SelectedItem" select="/Response/SearchCriteria/VAT_CODE"/>
<xsl:choose>
<xsl:when test="ID=$SelectedItem">
<xsl:element name="option">
<xsl:attribute name="selected">selected</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="ID"/></xsl:attribute>
<xsl:value-of select="Code"/>
</xsl:element>
</xsl:when>
<xsltherwise>
<option>
<xsl:attribute name="value"><xsl:value-of select="ID"/></xsl:attribute>
<xsl:value-of select="//Code"/>
</option>
</xsltherwise>
</xsl:choose>
</xsl:for-each>
</select>
</xsl:template>
And my section in .xml file looks like this :
<listdata>
<vatlist>
<Code>A001</Code>
<Code>A002</Code>
<Code>A003</Code>
</vatlist>
Can somebody tell me what's wrong with my combo box template function?
Thank you for advance!
I've this template which fill up a combo box by the .xml file results but my problem that I always get just the firs result from the .xml file.
<xsl:template match="listdata/vatlist">
<select class="bodydisplaytext" name="vat">
<xsl:if test="count/Response/listdata/vatlist/Code) > 1">
<option value="">ALL</option>
</xsl:if>
<xsl:for-each select="/Response/listdata/vatlist/Code">
<xsl:variable name="SelectedItem" select="/Response/SearchCriteria/VAT_CODE"/>
<xsl:choose>
<xsl:when test="ID=$SelectedItem">
<xsl:element name="option">
<xsl:attribute name="selected">selected</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="ID"/></xsl:attribute>
<xsl:value-of select="Code"/>
</xsl:element>
</xsl:when>
<xsltherwise>
<option>
<xsl:attribute name="value"><xsl:value-of select="ID"/></xsl:attribute>
<xsl:value-of select="//Code"/>
</option>
</xsltherwise>
</xsl:choose>
</xsl:for-each>
</select>
</xsl:template>
And my section in .xml file looks like this :
<listdata>
<vatlist>
<Code>A001</Code>
<Code>A002</Code>
<Code>A003</Code>
</vatlist>
Can somebody tell me what's wrong with my combo box template function?
Thank you for advance!