I am trying to get the value of one number from my XML in two decimal places.
XML: & lt; Quantity & gt; 0.0050 & lt; / Quantity & gt;
XSL: & lt; Xsl: Select Value = "Format-number ($ quantity, '# ### 0.00')" />
Although XSL has problems with this value and the output of 0.00
and 0.01
in one area of the page is definitely the other In the case of this it is suited to the 0.01
output in all areas.
The value of another area is 4.221
, even then XSL is outputting 4.23
.
I realize that as a method format-number
changes a number in a string.
Make sure how to fix it.
Edit:
This works:
& lt; Xsl: Select value = 'format-number (round (100 * $ quantity) div 100, "## 0.00")' / & gt;
The use of XSL as this man does 'circumscribe the bankers' to round the numbers rather than the larger ones.
The solution looks hardly elegant, and it means that adding a ton of extra functions to heavy and complicated XSL files is already done. Surely I'm missing something?
Obviously why the format would be so incompatible, but imagination for memory is complex ...
In the meantime, you can use the round
function (). Which is less than right, but functional. If you need a certain number then you get the power of "math"! and do something like this:
& lt; Xsl: Select Value = "Round (Your Num * 100) Div 100" />
Comments
Post a Comment