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:
“The path was a vague parting in the grass
That led us to a weathered windowsill.
We pressed our faces to the pane. You see, he said,
Everythings as she left it when she died....”
—Robert Frost (18741963)
“Let it be signified to me through any channel ... that the possession of the Floridas would be desirable to the United States, and in sixty days it will be accomplished.
...penned in the language of truth, and divested of those expressions of servility which would persuade his majesty that we are asking favors and not rights.”
—Thomas Jefferson (17431826)