Each non-initial occurrence of "//"
in a path expression is expanded as described in 3.2.4 Abbreviated Syntax,
leaving a sequence of steps separated by "/". This sequence of
steps is then evaluated from left to right. Each operation E1/E2 is evaluated
as follows: Expression E1 is evaluated, and if the result is not a (possibly
empty) sequence of nodes, a type error is raised [err:XPTY0019].
Each node resulting from the evaluation of E1 then serves in turn to provide
an inner focus for an evaluation of E2, as described in 2.1.2 Dynamic Context.
The sequences resulting from all the evaluations of E2 are combined as
follows: If every evaluation of E2 returns a (possibly empty) sequence of nodes, these sequences are combined, and duplicate nodes are eliminated based on node identity. The resulting node sequence is returned in document order. If every evaluation of E2 returns a (possibly empty) sequence of atomic values, these sequences are concatenated, in order, and returned. If the multiple evaluations of E2 return at least one node and at least one atomic value, a type error is raised [err:XPTY0018]. |