xsl:sort does not work with nodeset parameters
----------------------------------------------

         Key: XALANJ-2244
         URL: http://issues.apache.org/jira/browse/XALANJ-2244
     Project: XalanJ2
        Type: Bug
  Components: XSLTC  
 Environment: JDK 1.5.0_06
    Reporter: Nicolas


i create some number elements within a variable, pass them to a function that 
extract the maximum value, and i get an empty result.
this happens width jdk 1.5 default transformer, but not with Saxon transformer 
or jdk 1.4.2 default transformer.

simple function to calculate the maximum value of some nodes passed as 
parameter :
<xsl:template name="max">
        <xsl:param name="nodes" select="/.."/>
        <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:choose>
</xsl:template>

simple elements :
<xsl:variable name="foo">
   <xsl:element name="bar">
      <xsl:text>5</xsl:text>
   </xsl:element>
   <xsl:element name="bar">
      <xsl:text>8</xsl:text>
   </xsl:element>
   <xsl:element name="bar">
      <xsl:text>2</xsl:text>
   </xsl:element>
</xsl:variable> 

call the function :
<xsl:variable name="result">
  <xsl:call-template name="max">
      <xsl:with-param name="nodes" select="nodeset($foo)/bar"/>
  </xsl:call-template>
</xsl:variable>

see the result :
<xsl:value-of select="$result" />  is empty 

If i remove the <xsl:sort ...> line in the function, result is 5  (wich is 
logic)

If i use the function inline, it works :
<xsl:variable name="result">
    <xsl:for-each select="nodeset($foo)/bar">
        <xsl:sort data-type="number" order="descending"/>
        <xsl:if test="position() = 1">
            <xsl:value-of select="number(.)"/>
        </xsl:if>
    </xsl:for-each>
</xsl:variable> 
<xsl:value-of select="$result" /> is 8


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to