Return the average of the argument's numeric value.
avg (nodeset])
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.
There is no avg
function in XPath.
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'])