Xsl attachment: when conditions

I have a query related to xsl selection, inside xsl select is used Now I have two xsl: when the condition is there, like 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 if the approach is correct, since insise xsl: when .. I need to start only when the condition becomes true first, I should go only for the second xsl: when the condition, please advise that it is aloowed or not

+4
source share
2 answers

You cannot nest when directly inside 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> 
+10
source

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> 
+1
source

Source: https://habr.com/ru/post/1485407/


All Articles