|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] AW: format-number abd numerical truncation
Hi John, you didn't say with which xslt processor you got this funny result. Report it as a bug and/or use some other one. Regards, Markus __________________________ Markus Abt Comet Computer GmbH http://www.comet.de ---------- Von: Nunnington, John Gesendet: Donnerstag, 28. August 2003 17:42 An: XSL-List@xxxxxxxxxxxxxxxxxxxxxx Betreff: format-number abd numerical truncation Hi All, [2 part problem] We've encountered a problem with format-number where-by the value part actually changes according to the precision. XML: <?xml version="1.0" encoding="UTF-8"?> <AR_ITEMS elem="4"> <EVENTS elem="1"> <TOTAL elem="826"> <AMOUNT>0.00000073173</AMOUNT> </TOTAL> </EVENTS> <EVENTS elem="2"> <TOTAL elem="826"> <AMOUNT>0.0000073173</AMOUNT> </TOTAL> </EVENTS> <EVENTS elem="3"> <TOTAL elem="826"> <AMOUNT>0.000073173</AMOUNT> </TOTAL> </EVENTS> <EVENTS elem="4"> <TOTAL elem="826"> <AMOUNT>0.73173</AMOUNT> </TOTAL> </EVENTS> <EVENTS elem="5"> <TOTAL elem="826"> <AMOUNT>0.073173</AMOUNT> </TOTAL> </EVENTS> <EVENTS elem="6"> <TOTAL elem="826"> <AMOUNT>0.00073173</AMOUNT> </TOTAL> </EVENTS> </AR_ITEMS> XSL: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:output method="html" indent="yes"/> <!-- Main Driver Template --> <xsl:decimal-format zero-digit="0" decimal-separator="." name="df" grouping-separator="," per-mille="," pattern-separator=";"> </xsl:decimal-format> <xsl:strip-space elements="*"></xsl:strip-space> <xsl:template match="/"> <html> <HEAD> </HEAD> <body bgcolor="#ffffff"> <table bgcolor="#cfcfcf" cellpadding="5" cellspacing="2" border="1"> <tbody> <xsl:for-each select="//EVENTS"> <tr> <TD align="right"> <FONT size="3"> <xsl:if test="TOTAL[@elem = 826]"> <xsl:value-of select="format-number(TOTAL/AMOUNT,'0.0000')"/> </xsl:if> </FONT> </TD> </tr> </xsl:for-each> </tbody> </table> </body> </html> </xsl:template> </xsl:stylesheet> Resulting HTML: 0.0000 0.0000 0.1000 0.7317 0.7320 0.7000 ...we never fixed this so we though that we'd correct the rounding in the source program. This worked OK, as long as we had a full complement of digits after the decimal point. When we have a number with less, say 0.7320, it is being displayed at 0.732 Anybody ever comes across either of these problems and resolved them or found them to be persistent bugs? XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|






