fn:avg

Return average of a sequence of numbers.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

fn:avg(sequence $sequence) => double

Description

This aggregate function returns the average of the numeric values of the nodes of $sequence. The nodes of the sequence must all evaluate to numbers. If a node evaluates to the empty sequence it is discarded.

Argument

$sequence

sequence of nodes

Example

let $a := (17, 23, 11)
return avg($a)