Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - How to sort attributes to find min and max? [Thread Next] Re: How to sort attributes to find min and max?To: NULL Date: 3/22/2008 1:16:00 PM zw wrote: > I like to sort and find the min and max of time based on label type. > So in this case, for labels "C Initialization" I like to sort their > times to find the min and max after > sorting. I did already post an XSLT 1.0 solution. Here is an XSLT 2.0 solution: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:for-each-group select="Results/sampleResult" group-by="@label"> <xsl:value-of select="current-grouping-key()"/> <xsl:text> min is </xsl:text> <xsl:value-of select="min(current-group()/@time)"/> <xsl:text>, max is </xsl:text> <xsl:value-of select="max(current-group()/@time)"/> <xsl:text> </xsl:text> </xsl:for-each-group> </xsl:template> </xsl:stylesheet> -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
