We’re working on a web page that should be able to display prices such that spaces are the grouping separators and commas are the decimal separators. For example, the value 1234567.89 should display as 1 234 567,89. (We’re actually using   so we get a non-breaking space.)
This seems like the right XSL to do it, and it almost works, but I get a ‘.’ character after the rest of it. So I end up with '1 234 567,89.' instead of '1 234 567,89'.
<?xml version='1.0' encoding='iso-8859-1'?> <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:fo='http://www.w3.org/1999/XSL/Format' xmlns:msxsl='urn:schemas-microsoft-com:xslt' xmlns:hsi='http://www.myfakecompany.com/fakey' extension-element-prefixes='msxsl hsi'> <xsl:decimal-format name='euro' decimal-separator=',' grouping-separator=' '/> <xsl:template match='/'> <xsl:value-of select='format-number(1234567.89, '# ###.##;(# ###.##)', 'euro')'/> </xsl:template> </xsl:stylesheet>
Any ideas?
The format string is applied after the decimal separator is set, so you need to change it to:
I.e. with commas instead of periods.