# format-number

format-number($value as numeric?, $picture as xs:string) → xs:string

Formats a number as specified by a picture string, using the default decimal format

Arguments
| $value | numeric? | The number to be formatted
| $picture | xs:string | Picture showing how the number is to be formatted
Result | xs:string

format-number($value as numeric?, $picture as xs:string, $decimal-format-name as xs:string) → xs:string

Formats a number as specified by a picture string, using the named decimal format

Arguments
| $value | numeric? | The number to be formatted
| $picture | xs:string | Picture showing how the number is to be formatted
| $decimal-format-name | xs:string | Name of a decimal format definition defined in the context
Result | xs:string

Links to W3C specifications

Namespace: http://www.w3.org/2005/xpath-functions

Applies to: XPath 2.0, XSLT 2.0, XQuery 1.0 and later versions

XPath 2.0 Specification

XPath 3.0 Specification

Notes on the Saxon implementation

In Saxon 9.3 this becomes available for XPath/XQuery as well as XSLT. However, the query prolog declarations for defining a decimal format in XQuery are not yet implemented.

Next