fn:format-number

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

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

Arguments

 

$value

xs: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 xs: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

xs: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

Namespace

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

Links to W3C specifications

XPath 3.0 Functions and Operators

XPath 3.1 Functions and Operators

XSLT 2.0 Specification

Notes on the Saxon implementation

From Saxon 9.3 this function becomes available for XPath/XQuery as well as XSLT. The query prolog declarations for defining a decimal format in XQuery become available in Saxon 9.4.

The function rules have been enhanced to allow formatting using exponential notation in the XPath 3.1 version of the specification. These changes are implemented since Saxon 9.7, and are available provided XPath 3.1 is enabled.