Whenever a boolean is expected:
1. If a value of a different XPath data type is supplied:
•A non-empty node set evaluates to boolean true(). The empty node set evaluates to boolean false(). •A non-empty string value evaluates to boolean true(). The empty string evaluates to boolean false().
NOTE: As an alternative to this, USoft Blend offers "flag-based" string-to-boolean conversion. •The number values 0 (zero) and NaN (not-a-number) evaluate to boolean false(). Other number values evaluate to boolean true(). 2. If a comparison is supplied, that is to say, an XPath expression that contains one of the comparison operators =, !=, <=, <, >, >=, <> :
•If both operands are node sets, the comparison returns true() if there is any node in the first node set and any node in the second node set such that the result of comparing the string-value of the two nodes evaluates to true(). •If one operand is a node set and the other a boolean, the comparison returns true() if the result of converting the node-set to a boolean, when compared to the other boolean, evaluates to true(). •If one operand is a node set and the other a string or number, the comparison returns true() if the result of converting the node-set to a string value, when compared to the other value (string or number), evaluates to true(). •Comparisons between values that are both not a node set (ie., that are both either string, number or boolean) are compared as booleans if at least one of them is boolean; otherwise, as numbers if at least one of them is a number; otherwise, as two strings. |