XSLT format-number with comma for indian price

前端 未结 2 731
别那么骄傲
别那么骄傲 2020-12-12 05:18

I want to display a price for India, like this:

5,55,555

And not

555,555

There should be

2条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-12 05:40

    The XSLT 2.0 specification of format-number() allows irregular grouping separators as in your example.

    The XSLT 1.0 specification is based on the Java specification of DecimalFormat, which requires regular intervals between grouping separators.

    (To be more precise: the JDK 7 spec requires regular intervals, or at any rate, it treats the last interval as the one to be used: (the interval between the last one and the end of the integer is the one that is used. So "#,##,###,####" == "######,####" == "##,####,####". But the XSLT 1.0 spec refers specifically to JDK 1.1.8, which is pretty-well unobtainable nowadays; my recollection is that it was very vague on such questions, and later versions of the JDK specification essentially documented the bugs in the initial implementation. To the extent that JDK 1.1.8 was vague, XSLT 1.0 implementations are free to do their own thing.)

提交回复
热议问题