fn:sum

Return sum of a sequence of numbers.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

fn:sum(sequence $sequence) => double

Description

This aggregate function returns the sum of all numeric values in a sequence. If the argument is an empty sequence, the function returns the numerical value 0.

Argument

$sequence

sequence of numerical values

Examples

  • This query returns as sum of the sequence values the numerical value "4.2E1" of type xs:double:

    let    $a := (17, 23, 11, -10)
    return sum($a)