Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: group and find relative Min value

From: "Anthony Jones" <Ant@------------.--->
To: 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() &gt; 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 &lt; $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/




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent