fn:sum

fn:sum($srcval as xdt:anyAtomicType*) → xdt:anyAtomicType?

Function signature

$arg

xdt:anyAtomicType *

Result

xdt:anyAtomicType

Returns the total of a sequence of numbers or durations

XPath 2.0 Specification

Implemented. In 7.4, works on all numeric types and returns the same type as the arguments. Changed in 7.8 to return integer 0 for an empty sequence, rather than double 0.0. Changed in 8.1 to allow totalling of durations as well as numbers.

fn:sum($srcval as xdt:anyAtomicType*, $zero as xdt:anyAtomicType?) → xdt:anyAtomicType?

Function signature

$arg

xdt:anyAtomicType *

$zero

xdt:anyAtomicType ?

Result

xdt:anyAtomicType ?

Returns the total of a sequence of numbers, specifying the value to be returned for an empty sequence

XPath 2.0 Specification

Implemented in Saxon 8.1

Expand

Up  Next