Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
XPath 2.0
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Path expressions == 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 "<code>/</code>" operator, for example <code>a/b/c</code> (which is short for <code>child::a/child::b/child::c</code>). More formally, however, "<code>/</code>" 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 <code>a</code> selects all the element children of the context node that are named <code><a></code>; the expression <code>child::b</code> is then applied to each of these nodes, selecting all the <code><b></code> children of the <code><a></code> elements; and the expression <code>child::c</code> is then applied to each node in this sequence, which selects all the <code><c></code> children of these <code><b></code> elements. The "<code>/</code>" 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 "<code>/</code>" will be axis steps: these are largely unchanged from XPath 1.0, and are described in the article on [[XPath 1.0]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)