vrijdag 11 november 2011

How to format decimal in SharePoint Dataview


To translate numbers in SharePoint Dataview, SharePoint Designer generates
following code:

<xsl:value-of select="format-number(@YourField, "$#,##0.00;-$#,##0.00")"/>

Examples:
YourFieldResult
1234512,345.00
1234.51,234.50
0.0 0.00
If YourField contains a "," you need to use the decimal-format functionality which will get you something like this: Outside the xsl:template block: <xsl:decimal-format name="European" decimal-separator=',' grouping-separator='.' /> To display the field: <xsl:value-of select='format-number(translate(@YourField,",","."), "#.##0,00", "European")'/> Examples:
YourFieldResult
1234512.345,00
1234.51.234,50
0.0 0,00

Geen opmerkingen:

Een reactie posten