Project

Profile

Help

Bug #6363

closed

Incorrect result comparing untypedAtomic value to NaN

Added by Manikandan S 10 months ago. Updated 6 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
XPath conformance
Sprint/Milestone:
-
Start date:
2024-02-27
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
10, 11, 12, trunk
Fix Committed on Branch:
10, 11, 12, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java

Description

  • I have updated Saxon from version9.1 to version10.6. But for the same Xsl code getting different result. In Saxon10 by default its considering input parameter as string, But in Saxon9 its considering input parameter as number value. This is the expected behavior or something is wrong with input?
  • Input data fetched from database using query and whatever data is coming from database its converted into XML format and passed to Xpath function.
  • By default its considering input value as String that's why its returning NaN and same time some how its matching to the given condition then its returning true. but actual expectation here is its should return false for that condition.
<xsl:output method="xml" encoding="UTF-8"/>    
<xsl:param name="var.variable1"/>    
<xsl:template match="/">     
<result>       
<xsl:choose>         
<xsl:when test="(/TestData/amount &lt; number($var.variable1) or /TestData/amount = number($var.variable1))">           <CompValue>true</CompValue>         
</xsl:when>          
<xsl:otherwise>           
<CompValue>false</CompValue>         
</xsl:otherwise>       
</xsl:choose>        
<amount>         
<xsl:value-of select="/TestData/amount/text()"/>       
</amount>       
 <var1>         
<xsl:value-of select="number($var.variable1)"/>      
</var1>    
</result> 
</xsl:template> 
</xsl:stylesheet>

** Input data:**

<?xml version="1.0" encoding="UTF-8"?>
<TestData><amount>555</amount></TestData>

** Saxon 9.1 Output:**

<?xml version="1.0" encoding="UTF-8"?>
<result><CompValue>false</CompValue><amount>555</amount><var1>NaN</var1></result>

Saxon 10.6 Output:

<?xml version="1.0" encoding="UTF-8"?>
<result><CompValue>true</CompValue><amount>555</amount><var1>NaN</var1></result>

** Note:** Here I'm using Saxon 10.6 and Xpath 3.0

Please register to edit this issue

Also available in: Atom PDF