XPath 2.0 - 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 "/" 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:

    Imagination places the future world for us either above or below or in reincarnation. We dream of travels throughout the universe: is not the universe within us? We do not know the depths of our spirit. M The mysterious path leads within. In us, or nowhere, lies eternity with its worlds, the past and the future.
    Novalis [Friedrich Von Hardenberg] (1772–1801)

    Preschoolers think and talk in concrete, literal terms. When they hear a phrase such as “losing your temper,” they may wonder where the lost temper can be found. Other expressions they may hear in times of crisis—raising your voice, crying your eyes out, going to pieces, falling apart, picking on each other, you follow in your father’s footsteps—may be perplexing.
    Ruth Formanek (20th century)