Home >Online Product Documentation >Table of Contents >Positions in Relation to Parent Nodes
Positions in Relation to Parent Nodes
Positions are relative to the parent. Consider the following data, which has line numbers on the left for explanation only.
The following query returns the first y
element contained in each x
element. It returns the elements on lines 6 and 10. The XPath processor finds all x
elements. For each x
element, the XPath processor then returns the first y
element it finds.
The next query returns the first y
element that is contained in an x
element that is in the context node set. It returns the element on line 6. The XPath processor finds all y
elements inside x
elements. The XPath processor then returns the first element in that set.
The next query returns the empty set. The XPath processor finds the first x
element. It then searches that first x
element for the first y
. Because the first x
element does not contain a y
element, this query returns the empty set.