Assuming that each row is an object in your database I would simply either add an entity total and let it calculate it in an after commit flow or use a calculated field for it. That last one has some performance drawbacks but depending on how much data you have I would not worry about it much.
This way you do not have to use Xpath at all.
Regards,
Ronald