xsl:sort problem in named template with jdk 5

Discussion in 'XML' started by Nicolas, Dec 6, 2005.

  1. Nicolas

    Nicolas Guest

    Hi,

    I've been working on this problem for a couple of days and now i have no
    more ideas.

    first, this problem only happens with jdk 1.5, everything was fine with
    jdk1.4.

    I'm using a function to calculate the maximum value of some nodes passed
    as argument, which i found here :
    http://www.exslt.org/math/functions/max/math.max.html

    <xsl:template name="max">
    <xsl:param name="nodes" select="/.."/>
    <xsl:choose>
    <xsl:when test="not($nodes)">NaN</xsl:when>
    <xsl:eek:therwise>
    <xsl:for-each select="$nodes">
    <xsl:sort data-type="number" order="descending"/>
    <xsl:if test="position() = 1">
    <xsl:value-of select="number(.)"/>
    </xsl:if>
    </xsl:for-each>
    </xsl:eek:therwise>
    </xsl:choose>
    </xsl:template>

    Now, if I call this function, it returns nothing.
    <xsl:variable name="maxValue">
    <xsl:call-template name="max">
    <xsl:with-param name="nodes" select="/some/number/values"/>
    </xsl:call-template>
    </xsl:variable>

    If i remove the <xsl:sort .....> line in the function, it returns the
    first value (which is logic)

    If I use the function "inline", it works :
    <xsl:variable name="maxValue">
    <xsl:for-each select="/some/number/values">
    <xsl:sort data-type="number" order="descending"/>
    <xsl:if test="position() = 1">
    <xsl:value-of select="number(.)"/>
    </xsl:if>
    </xsl:for-each>
    </xsl:variable>


    Thanks for your help
     
    Nicolas, Dec 6, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Babar
    Replies:
    1
    Views:
    485
    Chris Smith
    May 20, 2004
  2. nobody
    Replies:
    0
    Views:
    568
    nobody
    Jun 1, 2004
  3. Replies:
    1
    Views:
    3,695
    A. Bolmarcich
    May 27, 2005
  4. Replies:
    2
    Views:
    9,359
    Martin Honnen
    Sep 5, 2006
  5. Navin
    Replies:
    1
    Views:
    770
    Ken Schaefer
    Sep 9, 2003
Loading...

Share This Page