hi all,
i'm trying to make a simple xpath statement that will return all elements that match two criteria. here's an example of the xml document structure.
what i want to be able to do is select utilities that are for a given product and at a given version. i'm using vb.net and loading the document as an xmldocument and then populating a nodelist using the selectnodes method. i can do this with something like "utilities/utility [product [@pName='p1']/version[.='1.0']]". however, for design reasons, i can't use this approach. instead, what i'd like to be able to do is say "//utility [//product [@pName='p1'] and //version [.='1.0']]".
the problem is, the the above statement returns all utilities that are either 'p1' OR '1.0', instead of returning utilities that match both. any way to get it to only return utilities that match all criteria?
thanks,
glenn
i'm trying to make a simple xpath statement that will return all elements that match two criteria. here's an example of the xml document structure.
Code:
<utilities>
<utility uName="u1">
<product pName="p1">
<version>1.0</version>
<version>1.2</version>
<product pName="p2">
</utility>
</utilities>
what i want to be able to do is select utilities that are for a given product and at a given version. i'm using vb.net and loading the document as an xmldocument and then populating a nodelist using the selectnodes method. i can do this with something like "utilities/utility [product [@pName='p1']/version[.='1.0']]". however, for design reasons, i can't use this approach. instead, what i'd like to be able to do is say "//utility [//product [@pName='p1'] and //version [.='1.0']]".
the problem is, the the above statement returns all utilities that are either 'p1' OR '1.0', instead of returning utilities that match both. any way to get it to only return utilities that match all criteria?
thanks,
glenn