Proper display of decimal comma in XSLT data view webpart

November 25th, 2009 | Categories: SharePoint, XSLT

If you’re having trouble with format-number function in XSLT data view – it’s probably because of decimal comma. The server returns data with decimal comma, and the format-number function works with decimal dot. The workaround is to translate the values

<xsl:value-of select="format-number(translate(translate(@NumberField,’.',’,'),’,',’.'), ‘#.##0,00;-#.##0,00′, ‘lcid1060′)" />

(in the example above the @NumberField represents the internal name of the field that contains numerical value.

Also make sure that in HTML just before the </xsl:stylesheet> tag you have included the following tag:

<xsl:decimal-format decimal-separator="," grouping-separator="." name="lcid1060" />

No comments yet.