Stylus Studio XML Editor

Table of contents

Appendices

3.3 Node-sets

Node-sets

A location path can be used as an expression. The expression returns the set of nodes selected by the path.

The | operator computes the union of its operands, which must be node-sets.

[Predicate] s are used to filter expressions in the same way that they are used in location paths. It is an error if the expression to be filtered does not evaluate to a node-set. The [Predicate] filters the node-set with respect to the child axis.

NOTE: 

The meaning of a [Predicate] depends crucially on which axis applies. For example, preceding::foo[1] returns the first foo element in reverse document order, because the axis that applies to the [1] predicate is the preceding axis; by contrast, (preceding::foo)[1] returns the first foo element in document order, because the axis that applies to the [1] predicate is the child axis.

The / and // operators compose an expression and a relative location path. It is an error if the expression does not evaluate to a node-set. The / operator does composition in the same way as when / is used in a location path. As in location paths, // is short for /descendant-or-self::node()/.

There are no types of objects that can be converted to node-sets.

3.3    UnionExpr   ::=    [PathExpr]
| [UnionExpr] '|' [PathExpr]
3.3    PathExpr   ::=    [LocationPath]
| [FilterExpr]
| [FilterExpr] '/' [RelativeLocationPath]
| [FilterExpr] '//' [RelativeLocationPath]
3.3    FilterExpr   ::=    [PrimaryExpr]
| [FilterExpr] [Predicate]