xsl:sort problem in named template with jdk 5

N

Nicolas

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top