Skip to content

Sum

Returns sum of child elements on current node or specified xpath.

1
myXml.Sum():number

Returns sum of child elements on current node or specified xpath.

1
myXml.Sum(xpath: string):number

Parameters

string xpath
    XPath to evaluate. If not specified current node childs are selected.

Remarks

Evaluate with an xpath

1
var totalAmount = $Xml.Sum('//Customer//Order/Total');

Evaluate with an xpath

1
var totalAmount = $Xml.Sum('//Customer//Order/Total');