Can I find one XML node with the most children with XPath?
<xml>
<node id="1">
<child />
<node>
<node id="2">
<child /><child />
<node>
<node id="3">
<child /><child />
<node>
<node id="4">
<child /><child /><child />
<node>
<node id="5">
<child /><child /><child />
<node>
</xml>
I would like to select either node 4 or node 5 with a single, pure XPath 1.0 expression.
I think that it is impossible because to count children you need function
count()which has one parameter – node-set and returns count of elements in this set. So you have no option how to count more node-sets than one to get max value.Note: I am talking about XPath 1.0