For example I have an XML sample like this
<a>
<a1>A1</a1>
<a11>A11</a11>
<a2>A2</a2>
Text <strong>text</strong> text...
<a>
How can I use XPath to select node a contain only
<a>
<a2>A2</a2>
Text <strong>text</strong> text...
<a>
Not sure if this is flexible enough for you, but it should get you started
You can play around with it easily here: http://www.xpathtester.com/test