Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: group and find relative Min value >Thread Next - Re: group and find relative Min value Re: group and find relative Min valueTo: NULL Date: 6/3/2006 4:54:00 PM
Ghena wrote:
> Please could you give me some web reference or some examples...
Here is a stylesheet that you could include
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template name="get-minimum">
<xsl:param name="nodes" />
<xsl:param name="current-minimum" select="number($nodes[1])" />
<xsl:variable name="head" select="$nodes[1]" />
<xsl:variable name="tail" select="$nodes[position() > 1]" />
<xsl:choose>
<xsl:when test="$tail">
<xsl:call-template name="get-minimum">
<xsl:with-param name="nodes" select="$tail" />
<xsl:with-param name="current-minimum">
<xsl:choose>
<xsl:when test="$current-minimum < $head">
<xsl:value-of select="$current-minimum" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$head" />
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$current-minimum" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Then where you want to find the minimum you do e.g.
<xsl:call-template name="get-mininum">
<xsl:with-param name="nodes" select="key('RouterList',Supplier)" />
</xsl:call-template>
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
