Magazine |
| | Community |
| | Workshop |
| | Tools & Samples |
| | Training |
| | Site Info |
|
|
||||||||
|
Filter patterns can contain Boolean expressions, comparison expressions, and set expressions. Shortcuts listed in the following table represent alternative symbols that are also provided in this XSL implementation. This documentation discusses these expression operators.
Operator | Shortcut | Description |
---|---|---|
$and$ | && | Logical-and |
$or$ | || | Logical-or |
$not$ | Negation | |
$eq$ | = | Equality |
$ieq$ | Case-insensitive equality | |
$ne$ | != | Not equal |
$ine$ | Case-insensitive inequality | |
$lt$ | < | Less than |
$ilt$ | Case-insensitive less than | |
$le$ | <= | Less than or equal |
$ile$ | Case-insensitive less than or equal | |
$gt$ | > | Greater than |
$igt$ | Case-insensitive greater than | |
$ge$ | >= | Greater than or equal |
$ige$ | Case-insensitive greater than or equal | |
$all$ | Set operation; returns TRUE if the condition is true for all items in the collection | |
$any$ | Set operation; returns TRUE if the condition is true for any item in the collection |
Precedence order (from highest to lowest) for comparison operators and Boolean operators is shown in the following table.
1. | ( ) | Grouping |
2. | = != $lt$ $le$ $gt$ $ge$ $eq$ $ne$ $ieq$ | Comparisons |
3. | $not$ | Boolean not |
4. | $and$ | Boolean and |
5. | $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 $op$ right-side-value), and return a Boolean result. Applications can provide additional operators as needed, although this practice is discouraged.
Operators are case sensitive.
The Boolean operators $and$ and $or$ perform logical-and and logical-or operations, respectively. The Boolean operators, in conjunction with grouping parentheses, can be used to build very sophisticated logical expressions. Note that spaces are not significant and can either be omitted or included to make the expressions easier for people to read.
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]
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 that 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]
See Also
Does this content meet your programming needs? Write us!
© 1998 Microsoft Corporation. All rights reserved. Terms of use.