I stumbled across the following XPATH expression applied on a certain root node:
.//*[not(child::*)]
child::* selects all the children nodes of the current node. .//* selects all nodes under the current node (including their children)
As a result, I would intuitively say that the expression selects.. all leaf nodes? ie. nodes that do not have any more children. That is, not(child::*) actually verifies the number of children to be 0.
Let's apply this expression on the root node of the following tree:
<root>
<A>
<C/>
<D/>
<E>
<F/>
<G>
<H/>
</G>
</E>
</A>
<B>
<I>
<J/>
<K/>
</I>
</B>
</root>
Am I correct when I say that my expression selects C D F H J K?