Frage

How to convert an integer value to a decimal value in XSLT?

For example, convert

15954 to 159.54

12376 to 123.76

22090 to 220.90

I used the format-number function, but it does not give the intended result.

format-number(22090,'#.##')
War es hilfreich?

Lösung

You'd clearly need to divide the number by 100 before formatting it, but also you need to use 0 rather than # after the decimal point to force 2dp.

format-number(theNumber div 100,'#.00')
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top