Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XSLT format-number() Function

XSLT format-number() Function


XSLT Function Reference Object Complete XSLT function reference


Definition and Usage

The format-number() function is used to convert a number into a string.


Syntax

string format-number(number,format,[decimalformat])

Parameters

Parameters Description
number Required. Specifies the number to format.
format Required. Specifies the formatting pattern. These are the characters used in the formatting pattern:
  • 0 (a digit)
  • # (a digit, zero displayed as empty)
  • . (the position of the decimal point. For example: ###.##)
  • , (the thousands grouping separator. For example: ###,###.##)
  • % (display the number as a percentage. For example: ##%)
  • ; (the pattern separator. The first pattern is for positive numbers, the second for negative numbers)
  • | | decimalformat | Optional. |

    Example 1

    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">






    View the XSL file、 View the result。


    XSLT Function Reference Object Complete XSLT function reference