XSLT 1.0: set variable value depending on condition -
i want set value of variable(b). if variable(a) not empty variable(b) equals variable(a). if empty set value 0.00. have tried couple of methods none of works.
<xsl:variable name="achecker" select="current()/money[last()]/value"/>
method 1:
<xsl:variable name="b"> <xsl:choose> <xsl:when test="$achecker != ''"> <xsl:value-of select="$achecker"/> <xsl:when> <xsl:otherwise> <xsl:value-of select="0.00"/> </xsl:otherwise> </xsl:choose> </xsl:variable>
i tried changing
<xsl:when test="$achecker != ''">
to
<xsl:when test="not($achecker)">
method 2:
<xsl:choose> <xsl:when test="$achecker != ''"> <xsl:variable name="b" select="$achecker"/> <xsl:when> <xsl:otherwise> <xsl:variable name="b" select="0.00"/> </xsl:otherwise> </xsl:choose>
Comments
Post a Comment