With my current node selected I wish to find an element <name>
[./name]
and return the text content. If an element <name>
does not exist in the currently selected node I wish to check the parent element [./parent::name]
and so on recursively up to the root, returning the value of the nearest parent where the element exists.
Can it be done with XPath?