Well the
double number type that XSLT/XPath 1.0 uses is the same as the number type Javascript uses and when you try javascript
: alert(0.3 + 0.3 + 0.3); in your browser you will get the same result. The reason is the binary representation of the number. You will need to round your result or (as you use Java) you could move to an XSLT 2.0 processor like Saxon 9 and then use the xs:decimal type instead of the double number type.
Additionally, with XSLT 1.0 if you want a certain format of numbers in your output you can use
http://www.w3.org/TR/xslt#format-number.