Lets say we have the following XML structure:
<a><b>2<d>4</d></b><c>3</c></a>
Why does sum(//*)
return 274?
Because it's 243 + 24 + 3 + 4 = 274
//*
means all elements, which are a
, b
, c
, and d
. Then, we summarize their text values, which include everything except tags.
I think, what you're looking for is sum(//*/text())
, which is 9 in this case
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With