XPath filtering on a count of matched nodes

amory_love

New Member
XML:\[code\]<docElement> <nodeA> <item aA1="aid1" aA2="bid2" aA3="valueA" /> <item aA1="aid2" aA2="bid1" aA3="valueB" /> <item aA1="aid3" aA2="bid2" aA3="valueA" /> <item aA1="aid4" aA2="bid1" aA3="valueA" /> </nodeA> <nodeB> <item aB1="bid1" aB2="value1" /> <item aB1="bid2" aB2="value2" /> </nodeB></docElement>\[/code\]nodeA/item/@aA2 <-links-> nodeB/item/@aB1I need to create a XmlNodeList of nodeB/item nodeswhere the count of linked nodeA/items is greater than 1 and the count of distinct nodeA/item/@aA3 values is greater then 1.(In this sample, it would be nodeB/item[0])Attempted first half:\[code\]XmlNodeList nodeBList = myDoc.DocumentElement.SelectNodes("nodeB/item[count(nodeA/item[@aA2 = current()/@aB1]) > 1]");\[/code\]Can this be done in XPath? Should it just be done in C#?Thanks!
 
Back
Top