[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Group and display the min value [for each item]

Subject: Group and display the min value [for each item]
From: "Giancarlo Rossi" <giancarlo_rossi@xxxxxxxxxx>
Date: Wed, 30 Aug 2006 09:18:19 +0200
select min group by
I'm trying to get the min value from an xml file.

This code works but sometimes doesnt take the just min value and most of all
not sort the results in a ascending way.
Could you help me ?
Regards.

you could see The xml file in www.lastminutesud.it/test/last_mad_lgw.xlm


<xsl:key name="OutwardList" match="Outward"
use="SegmentList/Segment/Operator/Name"/>
<xsl:template match="/">
<xsl:for-each
select="//Outward[generate-id(.)=generate-id(key('OutwardList',SegmentList/S
egment/Operator/Name))]">
<xsl:sort select="Price/Amount" order="ascending" data-type="number"/>
<xsl:variable name="ok_op" select="SegmentList/Segment/Operator/Name" />

<xsl:variable name="min">
<xsl:for-each
select="//Outward[SegmentList/Segment/Operator/Name=$ok_op]/Price/Amount/tex
t()">
<xsl:sort select="." order="ascending" data-type="number"/> <xsl:if
test="position() = 1"> <xsl:value-of select="."/> </xsl:if> </xsl:for-each>
</xsl:variable>

<xsl:value-of select="$min"/>

</xsl:for-each>
</xsl:template>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.