I have an XML like below in BI Publisher-
<ROW1>
<TOTAL_RETAIL>10.95</TOTAL_RETAIL>
<TOTAL_TAX> 1.8</TOTAL_TAX>
<TOTAL_SHIPPING>7.95</TOTAL_SHIPPING>
</ROW1>
<ROW1>
does not repeat. Now as I understand to do a SUM
of a node I can use XPath function sum()
like <?sum(.//TOTAL_RETAIL)?>
. This will sum the values of the node TOTAL_RETAIL
only, I want the sum of TOTAL_RETAIL
, TOTAL_TAX
, and TOTAL_SHIPPING
. Is there a way I can write the sum
function to achieve this.
Note- It cannot be handled programmatically i.e. using variables etc. since its inside a Report template and has to be defined as <?sum(...)?>
this values will be mapped to a specific cell in an excel report template.
Try
<?sum(.//TOTAL_RETAIL | .//TOTAL_TAX | .//TOTAL_SHIPPING)?>
|
is the union operator, so the argument you're passing to sum()
is the union of the three sub-expressions.