Yes, I read the requirement "return the node", not the example "return Honda
and Mitsubishi".
The solution *[count(*) = max(current()/*/count(*))] is easy to write, but
it's very dependent on optimization. Saxon will move the condition
max(current()/*/count(*)) out of the loop if it's written this way, but not
if it's written *[count(*) = max(../*/count(*))]. Even if the max() is
calculated outside the loop, you're visiting each node twice and calculating
the "key" (count(*) twice for each node. Hence the slight preference for the
sorting approach.
The most efficient solution is probably a recursive function, but that's not
the easiest to write. It really calls out for a higher-order function along
the lines of saxon:highest().
Michael Kay
http://www.saxonica.com/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--