//section[.//h1[@id='hi']]
This returns <section> if it has an <h1> descendant with id='hi'.
<section>
<h1>
id='hi'