SAXONICA

Saxon Documentation
Full Contents
About Saxon
Changes in this Release
Notices
Using XSLT 2.0
Using XQuery
Handling Source Documents
XML Schema Processing
XPath API for Java
Saxon on .NET
Extensibility
Saxon Extensions
Sample Saxon Applications
The Saxon SQL Extension
XSLT Elements
XPath 2.0 Expression Syntax
| Introduction
| Constants
| Variable References
| Function Calls
| Axis steps
| Parentheses and operator precedence
| Filter expressions
| Path expressions
| Cast as, Treat as
» | Set difference and intersection
| Union
| Arithmetic expressions
| Range expressions
| Comparisons
| Instance of and Castable as
| Conditional Expressions
| Quantified Expressions
| For Expressions
| Boolean expressions: AND and OR
| Sequence expressions
Function Library
Standards Conformance

# Set difference and intersection

These operators are new in XPath 2.0.

The expression `E1 except E2` selects all nodes that are in `E1` unless they are also in `E2`. Both expressions must return sequences of nodes. The results are returned in document order. For example, `@* except @note` returns all attributes except the `note` attribute.

The expression `E1 intersect E2` selects all nodes that are in both `E1` and `E2`. Both expressions must return sequences of nodes. The results are returned in document order. For example, `preceding::fig intersect ancestor::chapter//fig` returns all preceding `fig` elements within the current chapter.

Next