XSL:
<xsl:if test=".[foo or @bar]">
something
</xsl:if>
-
is it testing that if target is with ‘foo’ tag name or has a ‘bar’ attribute?
-
it works only in IE, I’m wondering if there is an error. What is the equivalent sentence but works cross-browser?
In XSLT 1.0 this is syntactically invalid and produces an error.
In XSLT 2.0 this is equivalent to:
The expression:
evaluates to
true()exactly when the context node (current node) has a child element namedfooor the context node has an attribute namedbar(or both).Otherwise this expression evaluates to
false().Therefore, the above code snippet means: If either of these conditions is true: the current node has a child element named
fooor the current node has an attribute namedbar— then output the string “something”