The location paths of XPath 1.0 are referred to in XPath 2.0 as path expressions. Informally, a path expression is a sequence of steps separated by the "/
" operator, for example a/b/c
(which is short for child::a/child::b/child::c
). More formally, however, "/
" is simply a binary operator that applies the expression on its right-hand side to each item in turn selected by the expression on the left hand side. So in this example, the expression a
selects all the element children of the context node that are named ; the expression
child::b
is then applied to each of these nodes, selecting all the children of the
elements; and the expression
child::c
is then applied to each node in this sequence, which selects all the
children of these elements.
The "/
" operator is generalized in XPath 2.0 to allow any kind of expression to be used as an operand: in XPath 1.0, the right-hand side was always an axis step. For example, a function call can be used on the right-hand side. The typing rules for the operator require that the result of the first operand is a sequence of nodes. The right hand operand can return either nodes or atomic values (but not a mixture). If the result consists of nodes, then duplicates are eliminated and the nodes are returned in document order, an ordering defined in terms of the relative positions of the nodes in the original XML tree.
In many cases the operands of "/
" will be axis steps: these are largely unchanged from XPath 1.0, and are described in the article on XPath 1.0.
Read more about this topic: XPath 2.0
Famous quotes containing the words path and/or expressions:
“So-called austerity, the stoic injunction, is the path towards universal destruction. It is the old, the fatal, competitive path. Pull in your belt is a slogan closely related to gird up your loins, or the guns-butter metaphor.”
—Wyndham Lewis (18821957)
“We ought to celebrate this hour by expressions of manly joy. Not thanks, not prayer seem quite the highest or truest name for our communication with the infinite,but glad and conspiring reception,reception that becomes giving in its turn, as the receiver is only the All-Giver in part and infancy.”
—Ralph Waldo Emerson (18031882)