and and or condition in single xml statement
I want to construct a statement containing and and multiple or expressions in xml li开发者_开发问答ke
<xsl:choose>
<xsl:when test="VAR1 and VAR1/text() != 'A' | 'B' | 'C'">
<xsl:value-of select="$data"/>
</xsl:when>
<xsl:otherwise>0.0</xsl:otherwise>
</xsl:choose>
but its nt working...
One solution, which avoids multiple comparisons is:
VAR1 and VAR1/text()[not(contains('A+B+C', .))]
where the +
string is guaranteed not to be contained in VAR1/text()
(if "+" doesn't satisfy this requirement, substitute "+" with a string that does)
Do note that there is a likely logical error in the question:
x != 'A' or x != 'B' or x != 'C'
is always true
Most probably you wanted:
x != 'A' and x != 'B' and x != 'C'
精彩评论