Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
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 wsxxx ws,where wsrefers 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 andand orperform 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.
Copy Code | |
---|---|
author[degree and award] |
Find all author elements that contain at least one degree or award and at least one publication.
Copy Code | |
---|---|
author[(degree or award) and publication] |
Boolean NOT
The Boolean notoperator 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.
Copy Code | |
---|---|
author[degree and not(publication)] |
Find all author elements that contain publication elements but do not contain either degree elements or award elements.
Copy Code | |
---|---|
author[not(degree or award) and publication] |