xsl-list
[Top] [All Lists]

Re: [xsl] Find the node with maximum elements

2007-11-04 06:38:53
On 11/4/07, G. Ken Holman <gkholman(_at_)cranesoftwrights(_dot_)com> wrote:
Which is what I already indicated in my response:

At 2007-11-03 15:19 -0400, G. Ken Holman wrote:
You can optimize the speed by putting the max value into a variable
and testing against that

Sorry, Ken. Unfortunately, I didn't read your post completely.

<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="2.0">

<xsl:output method="text"/>

<xsl:template match="/">
  <xsl:value-of select="/Sample/*[count(Car)=max(/Sample/*/count(Car))]
                        /name(.)"
                separator="&#xa;"/>
</xsl:template>

</xsl:stylesheet>

This solution is nice. But if the OP wants to do something else with
the result (not just printing the result (sequence), as this solution
demonstrates), then I think xsl:for-each loop will be necessary.

-- 
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
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>
--~--