xslt format-number decimal, number less than one
16,460
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)
Author by
Tillebeck
OpenGate solve any TYPO3 and Umbraco assignments you may have
Updated on June 04, 2022Comments
-
Tillebeck almost 2 years
I have this as input called $material_price:
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)