format-number rounding error
Hi, I am trying to generate PDF using FOP. But I got a rounding error when using the following fo script fo:block xsl:value-of select=format-number(0.5,'0')/ /fo:block The result from fop is 0 instead of 1 Is this a bug? How do we get around of it? Thanks LZ __ Do you Yahoo!? Yahoo! Movies - Buy advance tickets for 'Shrek 2' http://movies.yahoo.com/showtimes/movie?mid=1808405861 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: format-number rounding error
lijun zou wrote: Hi, I am trying to generate PDF using FOP. But I got a rounding error when using the following fo script fo:block xsl:value-of select=format-number(0.5,'0')/ /fo:block This is not a rounding error You have specified your format to be 0, so the string 0 is always output. I think what you need is: xsl:value-of select=format-number(0.5,'#,##0.0')/ snip/ Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: format-number rounding error
lijun zou wrote: No, It is an error. '0' is a pattern, meaning round to integer. Perhaps you are right. But this is really the wrong forum for this question as its a pure xslt question. You will get better answers on the xsl-list: http://lists.mulberrytech.com/xsl-list/ I use other formatter, the result is ok. Its the XSLT processor that is responsible for the format-number() function, FOP uses Xalan by default. What XSLT processor is this other formatter using? snip/ Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: format-number rounding error
-Original Message- From: Chris Bowditch [mailto:[EMAIL PROTECTED] lijun zou wrote: No, It is an error. '0' is a pattern, meaning round to integer. Perhaps you are right. But this is really the wrong forum for this question as its a pure xslt question. You will get better answers on the xsl-list: Hi, A pure XSLT question indeed, but I'm wondering why the OP doesn't simply use the round() function (which does *exactly* what he needs) Cheers, Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]