xsl-list
[Top] [All Lists]

[xsl] Group and display the min value [for each item]

2006-08-30 00:18:28
 
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>


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

<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] Group and display the min value [for each item], Giancarlo Rossi <=