I'm new to XPath and not sure how to get the attribute value of a parent element if a specific child element exists.
<planet name="Earth" star="Sun">
<primary>
<oxygen>20.95%</oxygen>
<water>70.8%</water>
</primary>
</planet>
What should be my XPath to get the @name
attribute from the element <planet>
if the <oxygen>
element is present within primary?