I'm not fully familiar with XPath. I did an extensive search and only found a solution for immediate children.
Requirement is to select an element who does not have any child, grand child, grand grand child, or any child that is present in its family tree which has a text node in it.
A simple example is:-
If I run the following XPath query:-
It gives following output:-
Element='<p/>' Element='<p> <span/> </p>' Element='<p> <span>notemptychild</span> </p>'
(I'm using freeformatter xpath tool: http://www.freeformatter.com/xpath-tester.html)
The first Element is a valid selection.
The second Element is a valid selection.
The third Element is NOT a valid selection because
span has a text node in it.
I hope I didn't made the question over complicated.