[ http://issues.apache.org/jira/browse/XALANJ-2034?page=history ]
     
Henry Zongaro resolved XALANJ-2034:
-----------------------------------

    Resolution: Invalid

As Dave indicates, Xalan-J is functioning correctly.  The value will be 
converted to a number implicitly through the XPath number function, the 
description of which reads as follows:[1]

<<
a string that consists of optional whitespace followed by an optional minus 
sign followed by a Number followed by whitespace is converted to the IEEE 754 
number that is nearest (according to the IEEE 754 round-to-nearest rule) to the 
mathematical value represented by the string; any other string is converted to 
NaN
>>

A Number is a string of digits and at most one decimal point.  No plus sign is 
permitted.

[1] http://www.w3.org/TR/xpath#section-Number-Functions

> Numbers with a '+' sign is incorrectly passed to an extension funcion as NaN
> ----------------------------------------------------------------------------
>
>          Key: XALANJ-2034
>          URL: http://issues.apache.org/jira/browse/XALANJ-2034
>      Project: XalanJ2
>         Type: Bug
>   Components: Xalan
>     Versions: 2.6
>  Environment: Windows 2000
>     Reporter: Mahesh N

>
> If the input number contains a number preceeded by a '+' the processor passes 
> a value 'Nan' to the extension function.  The output is as shown below
> --- output ---
> TransformerFactory is [EMAIL PROTECTED]
> Xalan version is Xalan Java 2.6.0
> Transformer is [EMAIL PROTECTED]
> <?xml version="1.0" encoding="UTF-8"?>
> <Number xmlns:test="mypackage1.BugTest"> The number is - NaN</Number>
> --- end output ---
> The source to reproduce this problem is as below. 
> --- BugTest.java ----------
> package mypackage1;
> import javax.xml.transform.Transformer;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.stream.StreamResult;
> import javax.xml.transform.stream.StreamSource;
> import org.apache.xalan.Version;
> public class BugTest 
> {
>    static String XSL_FILENAME = "XalanBug.xsl";
>    static String XML_FILENAME = "XalanBug.xml";
>       public static void main(String[] args)
>     throws Exception
>   {
>       TransformerFactory tFactory = TransformerFactory.newInstance();
>     System.out.println("TransformerFactory is "+tFactory);
>     System.out.println("Xalan version is "+Version.getVersion());
>     Transformer transformer = tFactory.newTransformer(new 
> StreamSource(XSL_FILENAME));
>     System.out.println("Transformer is "+transformer);
>     transformer.transform(new StreamSource(XML_FILENAME), new 
> StreamResult(System.out));
>   }
>   
>   public static String checkValue(double value)
>   {
>     if(value > 15)
>        return "15.0";
>     else
>        return ""+value;
>   }
> }
> ---- End BugTest.java -----
> ----- XalanBug.xml -----
> <?xml version='1.0' encoding='windows-1252'?>
> <Numbers>
>   <Number>+45</Number>
> </Numbers>
> ----- End XalanBug.xml ----
> ----- XalanBug.xsl -----
> <?xml version='1.0' encoding='windows-1252'?>
> <xsl:stylesheet version="1.0"
>           xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>           xmlns:test="mypackage1.BugTest">
>    <!-- Root template -->
>    <xsl:template match="/">
>         <Number> The number is - <xsl:value-of 
> select="test:checkValue(/Numbers/Number)"/>
>         </Number>
>    </xsl:template>
> </xsl:stylesheet>
> ----- End XalanBug.xsl -----

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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

Reply via email to