You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2004/06/18 00:25:36 UTC

DO NOT REPLY [Bug 29655] New: - XString.num and number XSLT function return incorrect number with trailing whitespace

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=29655>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=29655

XString.num and number XSLT function return incorrect number with trailing whitespace

           Summary: XString.num and number XSLT function return incorrect
                    number with trailing whitespace
           Product: XalanJ2
           Version: 2.6
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xpath
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: kburke@lunarlogic.com


The XString.num() and toDouble() methods truncate the floating point portion of a number if the string 
contains a number with trailing whitespace.  So, if the tag

<tag>    1.5    </tag>

is created with the DOM, and the number() xslt function is called, 1.0 is returned.  This does not occur 
if that XML was in a file, parsed by Xerces and run through Xalan, but does occur if the tag is created in 
memory and run through Xalan.  This may be because the XStringForFSB class is used instead, which 
has the correct behavior.  A test case will be attached that demonstrates differences in behavior 
between the two classes, and a patch will be included that provides almost identical behavior between 
the two.  In general, the toDouble method in the XStringForFSB seems superior from a consistency and 
performance perspective.

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org