[ http://nagoya.apache.org/jira/browse/XALANJ-2034?page=comments#action_57074 ] David Bertoni commented on XALANJ-2034: ---------------------------------------
I don't know which "XSL spec" you are referring to, but the XPath recommendation is clear that "+45" and "+30E-1" are not valid lexical representations for a number. Xalan-J's behavior (converting these strings to NaN) is correct. > Numbers with a '+' sign is incorrectly passed to an extension funcion as NaN > ---------------------------------------------------------------------------- > > Key: XALANJ-2034 > URL: http://nagoya.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://nagoya.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]
