Boolean, Comparison, and Set Expressions (Windows Embedded CE 6.0)
1/6/2010
Filter patterns can contain Boolean expressions, comparison expressions, and set expressions. Shortcuts listed in the following table represent alternative symbols that are provided in this XSL Transformations (XSLT) implementation. This documentation discusses these expression operators.
Operator | Description |
---|---|
and |
Logical-and |
or |
Logical-or |
not() |
Negation |
= |
Equality |
!= * |
Not equal |
< * |
Less than |
<= * |
Less than or equal |
> * |
Greater than |
>= * |
Greater than or equal |
| |
Set operation; returns the union of two sets of nodes |
* extended XPath method
The Worldwide Web Consortium (W3C) syntax for operator keywords uses white space and other separators. In the W3C syntax, a binary keyword can be expressed as wsxxxws, where ws refers to a token terminator that can be white space, single quote characters ('), or double quote characters ("). Unary operators such as not() use functional notation.
Precedence order (from highest to lowest) for comparison operators and Boolean operators is shown in the following table.
Operator | Meaning |
---|---|
( ) |
Grouping |
[ ] |
Filters |
/ // |
Path operations |
< <= > >= |
Comparisons |
= != |
Comparisons |
| |
Union |
not() |
Boolean not |
and |
Boolean and |
or |
Boolean or |
Boolean expressions can match all nodes of a particular value or all nodes with nodes in particular ranges. Boolean expressions are in the form (left-side value operator right-side value) and return a Boolean result.
Operators are case-sensitive.
Boolean AND and OR
The Boolean operators and and or perform logical-and and logical-or operations, respectively. These operators, in conjunction with grouping parentheses, can be used to build sophisticated logical expressions.
Examples
Find all author elements that contain at least one degree and one award.
author[degree and award]
Find all author elements that contain at least one degree or award and at least one publication.
author[(degree or award) and publication]
Boolean NOT
The Boolean not operator negates the value of an expression within a filter pattern.
Examples
Find all author elements that contain at least one degree element and contain no publication elements.
author[degree and not(publication)]
Find all author elements that contain publication elements but do not contain either degree elements or award elements.
author[not(degree or award) and publication]