Rather than wasting time designing an XPath to handle all corner cases in such a poorly designed XML, I would spend time finding out who created such an XML and then firing or atleast censuring him/her.
On Nov 9, 2:18 pm, Faraz Azhar <[email protected]> wrote: > > sum(/Database/it...@code='4000']/Item) > > Hmm.. this works on above XML file. But if I specify the Code as 4001 > (Code=4001) , then it returns zero. I guess I can make a work-around > for that. > But this is my real XML file.. it has nested nodes in it. Have a > look:http://dotnetdevelopment.pastebin.com/m4aee52fb > > I write the XPath query as follows: "sum(/Accounts/accou...@code=4003]/ > Account)" .. It doesnt work. > I want to have a query in which if I specify the Code=4003, it should > give me sum of 4003.1, 4003.2, 4003.3 which would be 11100. > And if I specify Code=4000, it should sum all the child nodes; which > are 4001,4002,4003,4003.1,4003.2,4003.3 and should return 50760 value.
