Show Numbers with a Different Locale in a SharePoint DVWP

Here’s a great little trick from an MSDN Forum thread I was trying to help out in.  Thanks to Playerkiller for this one.

Suppose you’d like just a single DVWP to display numbers (either currency or regular numbers) in a different locale than the host site.  This trick lets you do just that.

Prerequisites: Numbers are shown with US notation so: 1000.00

1. Open the page you need to customize with Sharepoint Designer. Switch to code view. Perform a search to find the tag xsl:decimal-format. Change the whole line with:

<xsl:decimal-format name=”European” decimal-separator=”,” grouping-separator=”.” minus-sign=”-” NaN=”error” />

2. Now, locate your <xsl:value-of select=”@URENBESTDEZPER”/> and replace it as follows:

<xsl:value-of select=”format-number(@URENBESTDEZPER, ‘€#.###,00;-€#.###,00’, ‘European’)”/>

You should have replaced your view. ;)

(I made a few small edits, but the work was all Playerkiller‘s.)