XPath - How can I query the parent node that satisfies the condition of the attribute being present?
I need to query a node to determine if it has a parent node that contains the specified attribute. For instance:
<a b="value">
<b/>
</a>
From element b as my focus, I would like to execute an XPath query:
..[@b]
which returns the element a . The returned element must be the parent of node a and must not contain any of the strong members of a .
The lxml.etree library states that this is an invalid XPath expression.
+1
a source to share