Is there any possibility to include multiple conditions in ‘test’ attribute expression in <xsl:if> tag of XSLT like
<xsl:if test="$var='ab' | $var='bc' | $var='ca' ">
</xsl:if>
I am getting an error as
“Expression must be evaluated to a node-set”.
Is there any possibility to code such multiple conditions in <xsl:if> Tag?
Can anyone explain how can we achieve this multiple condition validation for the following tags in
<xsl:if> in test attribute expression
<xsl:for-each> in select attribute expression
<xsl:template> in match attribute expression
?
This is wrong — you are using the XPath union operator
|on boolean values.Solution: use the XPath
oroperator:The above XPath expression (the value of the
testattribute) can be optimized, so that only one comparison is made and nooris necessary: