Use the parent axis with the name of the parent node.
//*[title="50"]/parent::store
This XPath will only select the parent node if it is a store .
But you can also use one of these
//*[title="50"]/parent::* //*[title="50"]/..
These xpaths will select any parent node. Therefore, if the document changes, you will always select the node, even if it is not the node that you expect.
EDIT
What happens in this example where the parent is the bike and the parent is the store?
Is it climbing?
No, he chooses the repository only if he is the parent of the node that matches //*[title="50"] .
If not, is there a way to rise in such cases and return None if there is no such parent?
Yes you can use ancestor axes
//*[title="50"]/ancestor::store
This will select all the ancestors of the corresponding node //*[title="50"] , which are 'repositories. E.G.
<data xmlns:d="defiant-namespace" d:mi="23"> <store mi="1"> <store mi="22"> <book price="8.95" d:price="Number" d:mi="13"> <title d:constr="String" d:mi="10">50</title> <category d:constr="String" d:mi="11">reference</category> <author d:constr="String" d:mi="12">Nigel Rees</author> </book> </store> </store> </data>

RenΓ© Link Jan 30 '15 at 14:14 2015-01-30 14:14
source share