Domanda

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,'#.##')
È stato utile?

Soluzione

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')
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top