xslt format-number decimal, number less than one
I have this as input called $material_p开发者_运维问答rice:
2.40
1000
0.60
They run through
<!-- setup currency rendering -->
<xsl:decimal-format name="dkk" decimal-separator="," grouping-separator="."/>
<xsl:value-of select="format-number($material_price, '#.###,00', 'dkk')"/>
Output is:
2,40
1.000,00
,60
How can I make changes to the xslt so last output is 0,60 and not ,60 (without the zero)
Like this:
<xsl:value-of select="format-number($material_price, '#.##0,00', 'dkk')"/>
The second parameter (picture string) is described as follows by the documentation.
Required. Specifies the format pattern. Here are some of the characters used in the formatting pattern:
- 0 (Digit)
(Digit, zero shows as absent)
- . (The position of the decimal point Example: ###.##)
- , (The group separator for thousands. Example: ###,###.##)
- % (Displays the number as a percentage. Example: ##%)
- ; (Pattern separator. The first pattern will be used for positive numbers and the second for negative numbers)
精彩评论