[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: number() in Xpath overflows in Linux
> This issue is product-specific. But I suppose it merits some discussion as to what the specs have to say on the subject. XPath 1.0 defines the number() function in terms of the rules for numeric literals. There are no rules discussing limits on the size of a numeric literal. You can either interpret that as meaning there are no limits (but how many products would accept a zillion trailing zeros?) or as meaning that the limits are implementation-defined, in which case your product is within its rights to reject an 18-digit number. More recent specs, sadly, are not much better. XSLT 2.0 and XPath 2.0 defer to XML Schema for the rules for string-to-double conversion, and XML Schema isn't clear on the subject. There has been a lot of debate on this recently in connection with xs:decimal, where implementations are allowed to impose limits on the value space: the question is, if you specify more digits than the implementation can handle, should it reject the value or round it? There's been less discussion in the case of xs:double, where the value space is fixed (not implementation-dependent) - but it's still true that the specs simply don't say where there can be limits on the nunber of characters in the lexical representation. A fairly sorry state of affairs, I'm afraid, and it means that you might not have much luck with your bug report. You can always try a different product, of course. Michael Kay http://www.saxonica.com/ > > > > > We are using number() in our XSL Transformation, > > > > number() in Xpath overflows for the numeric value > > "1000000000.000000000" > > to "-844674407.3709551" in Linux environment. > > 1000000000.000000000 : Fails > > 1000000000.00000000 : Works > > > > The xsl file is, > > <?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet > > version="1.0" > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template > > match="/"> > > <xml> > > <body> > > <table border="1"> > > <tr bgcolor="#9acd32"> > > <th align="left">Price</th> > > </tr> > > <xsl:for-each select="catalog/cd"> > > <tr> > > <td><xsl:value-of > > select="(number(normalize-space(1000000000.000000000)))"/></td> > > </tr> > > </xsl:for-each> > > </table> > > </body> > > </xml> > > </xsl:template></xsl:stylesheet> > > > > And the xml file is > > <?xml version="1.0" encoding="ISO-8859-1"?> <catalog> > > <cd> > > <title>Empire Burlesque</title> > > <artist>Bob Dylan</artist> > > <country>USA</country> > > <company>Columbia</company> > > <price>1000000000.000000000</price> > > <year>1985</year> > > </cd> > > </catalog> > > > > Thanks, > > Vishwa
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|