Reputation:
I have a query related to xsl choose , inside xsl choose is being used Now i have two xsl:when condition is there like as hsown below
<xsl:choose>
<xsl:when test=$labcVar=$cde>
<xsl:when test="$erf=$der">
<xsl:value-of select="'edr'" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'fre'" />
</xsl:otherwise>
please advise is it the correct approach since insise xsl:when ..I have to begain only when first when condition becomes true the only I should go for second xsl:when condition, please advsie it is aloowed or not
Upvotes: 9
Views: 20740
Reputation: 122414
You can't nest a when
directly inside a when
, but you can use another choose
:
<xsl:choose>
<xsl:when test=$labcVar=$cde>
<xsl:choose>
<xsl:when test="$erf=$der">
<xsl:value-of select="'edr'" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'fre'" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
Upvotes: 18
Reputation: 221255
How about using and
<xsl:when test="$labcVar=$cde and $erf=$der">
<xsl:value-of select="'edr'" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'fre'" />
</xsl:otherwise>
Upvotes: 2