The parent
axis contains only the parent of a node. The following expression selects the html
element by taking a detour over the body
element:
/child::html/child::body/parent::html
..
is a shortcut for parent::node()
The ancestor
and ancestor-or-self
axes traverse all ancestors of a node. The following expression returns all div
elements that are ancestors of the context node:
ancestor::div