Hi,

You could try <xsl:value-of select='format-number(sum(b/a),'#.##')'/>

Regards,

Padraig

ywj wrote:

> Hi, everyone
> This is the first time that I mail to mailto:[EMAIL PROTECTED]
> It is so nice that I can communicate with you.
> My question is that:
> I use sum() in XSLT file to add up the float(or double) content of
> some nodes in xml file, but the result of sum is not like what I expected.
> For example:
> The fragment of xml file:
> <b>
> <a>1.11</a>
> <a>2.22</a>
> <a>3.33</a>
> </b>
> The fragment of xslt file:
> <xsl:value-of select = "sum(b/a)" />
> the result value is not 6.66, but 6.6600000000003.
> I use xalan-j_2_2_D14 and jdk1.3.1.
> I know one of the way is to use round(), but I do not know I should
> keep how many digits after decimal point if the xml file is created
> dynamically. Who can give me some advice?
> Thank you very much!
> regards
> yang Wenjun




Reply via email to