If your XML was something like this:
<?xml version="1.0" encoding="UTF-8"?>
<cart>
<items>
<item>
<sku><![CDATA[123]]></sku>
<discAmt>0.1</discAmt>
</item>
<item>
<sku><![CDATA[456]]></sku>
<discAmt>0.2</discAmt>
</item>
<item>
<sku><![CDATA[789]]></sku>
<discAmt>0.3</discAmt>
</item>
</items>
</cart>
Then you could loop through the nodes in your XML and use the add function to keep a running total of the dsctAmt
values.
%%[
var @xml, @isXML, @nodes, @rowCount
set @xml = AttributeValue("xml")
if indexOf(@xml,"<cart>") > 0 then
set @nodes = BuildRowsetFromXML(@xml,"/cart/items/item",0)
set @rowCount = rowcount(@nodes)
if @rowCount > 0 then
var @totalDiscAmt
set @totalDiscAmt = 0
for @i = 1 to @rowCount do
var @nodepath
var @sku
var @discAmt
set @discAmt = 0
set @nodepath = concat("/cart/items/item[",@i,"]/")
if rowcount(BuildRowsetFromXML(@xml,concat(@nodepath,"sku"))) > 0 then
set @sku = Field(Row(BuildRowsetFromXML(@xml,concat(@nodepath,"sku"),0),1),'Value')
endif
if rowcount(BuildRowsetFromXML(@xml,concat(@nodepath,"discAmt"))) > 0 then
set @discAmt = Field(Row(BuildRowsetFromXML(@xml,concat(@nodepath,"discAmt"),0),1),'Value')
set @totalDiscAmt = add(@totalDiscAmt,@discAmt)
endif
if not empty(@sku) then
]%%
<br>sku: %%=v(@sku)=%% %%=v(@discAmt)=%%</a>
%%[
endif
next @i
]%%
<br><br>totalDiscAmt: %%=v(@totalDiscAmt)=%% <br>
%%[
else
outputline(concat("<br>no products found"))
endif
else
outputline(concat("<br>no XML found"))
endif
]%%