Using XPath or a XQuery, how do I select the node with the most occurrences of another node?
For example how do I find the basket which has the most eggs?
<basket name="1">
<egg></egg>
<egg></egg>
</basket>
<basket name="2">
<egg></egg>
</basket>
<basket name="3">
<egg></egg>
<egg></egg>
<egg></egg>
<egg></egg>
</basket>
This is one solution (TIMTOWTDI):