number function
The fn:number function converts a value to the xs:double data type.
Syntax
- atomic-value
- An atomic value or the empty sequence. If atomic-value is not specified, fn:number is evaluated for the current context item.
Returned value
If atomic-value is not the empty sequence, the returned value is the result of casting atomic-value as xs:double. If atomic-value cannot be cast to the xs:double data type, NaN is returned.
If numeric-value is the empty sequence, NaN is returned.
Examples
Example of converting an xs:decimal value to xs:double: The following function converts the xs:decimal value 2.75 to xs:double.
fn:number(2.75)
The returned value is 2.75E0.
Example of converting an xs:boolean value to xs:double: The following function converts the boolean value false() to xs:double.
fn:number(false())
The returned value is 0.0E0.