Summation of child values belonging to different parents.
How is this achieve?
In this example:
<NewDataSet>
<Table>
<ColumnGrp>sss</ColumnGrp>
<MV>10</MV>
<RowGrp>ABC</RowGrp>
<RowSubGrp>ABC</RowSubGrp>
<nature>Active</nature>
</Table>
<Table1>
<ColumnGrp>aaa</ColumnGrp>
<MV>15</MV>
<RowGrp>NULL</RowGrp>
<RowSubGrp>PQG</RowSubGrp>
<nature>Passive</nature>
</Table1>
</NewDataSet>
How can i sum up the MV values? Thanks
[625 byte] By [
onggie80] at [2007-11-19 1:43:20]

# 1 Re: Summation of child values belonging to different parents.
Ahh now you see why it's bad to have elements of the same type have different names.
There are several ways to work around this. If it's OK to sum accross all, MV elements in the document, you could just write sum(//MV).
If you want something more specific you could write sum(Table/MV|Table1/MV), assuming you current node is the NewDataSet node. Or maybe it should be sum(Table|Table1/MV) I don't remember which binds harder | or /, you will have to work that out your self.
Finally you try something clever like this sum(*[starts-with(name(),'Table')]/MV)
khp at 2007-11-10 3:27:56 >
