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 9:07:00 PM
"Martin Honnen" <mahotrash@y...> wrote in message
news:ufF0Z2xhGHA.3756@T......
>
>
> 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>
>
>
Have you ever tested the depth to which this sort recursion can be taken, is
there a limit?
Isn't the need to write such a monster for what elsewhere is a fairly basic
(even intrinsic) function indicative the perhaps XSL isn't a good choice
here? XSL may form part of a useful solution but this sort of work should
be done somewhere else surely?
> --
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
