### Path expressions

A path expression is a sequence of steps separated by the /''' or '''// operator. For example, ../@desc selects the desc attribute of the parent of the context node.

In XPath 2.0, path expressions have been generalized so that any expression can be used as an operand of /, (both on the left and the right), as long as its value is a sequence of nodes. For example, it is possible to use a union expression (in parentheses) or a call to the id() function.

In practice, it only makes sense to use expressions on the right of "/" if they depend on the context item. It is legal to write $x/$y provided both $x and $y are sequences of nodes, but the result is exactly the same as writing ./$y .

Note that the expressions ./$X or $X/. can be used to remove duplicates from $X and sort the results into document order.

The operator // is an abbreviation for /descendant-or-self::node(). An expression of the form /E is shorthand for root(.)/E, and the expression /''' on its own is shorthand for '''root(.).