Tamino XML Server Version 9.7
 —  X-Query Reference Guide  —

avg

Return the average of the argument's numeric value.


Syntax

avg (nodeset])

Top of page

Description

This function returns the average of the numeric value of the nodes of a node set. If you specify a node set that contains more than one node, all nodes of the set are taken for evaluation.

If necessary, node values are converted to numerical values. If a node value cannot be converted, then NaN is used. This function returns NaN, if at least one argument is NaN.

Top of page

Compatibility

There is no avg function in XPath.

Top of page

Example

Compute the average age of all male patients (subtract from the current year the average value of the aggregated /patient/born nodes):

2002 - avg(/patient/born[../sex~='male'])

Top of page