# fn:number

fn:number() → double

Function signature

Result | xs:double

Converts the string value of the context node to a number

XPath 2.0 Specification

Note:Saxon 7.4 implements some incompatible changes to this function defined in XPath 2.0. When given an empty sequence as the argument, the number function now returns an empty sequence, rather than NaN. When given a value that is not a valid number, it raises an error rather than returning NaN. The strings "INF" and "-INF" are recognized as representations of positive and negative infinity.

fn:number(item()? $srcval) → double

Function signature

$srcval | item() ?
Result | xs:double

Converts the string value of the given node to a number

XPath 2.0 Specification

Note:Implementation follows the XPath 1.0 specification. Changed in 7.4 so that if the argument is the empty sequence, the result is the empty sequence - this causes some backwards compatibility problems.

Expand | Up Next