Xml – How to SelectNodes with multiple attribute crieria using XML in ASP classic

asp-classicxml

I know how to selectnodes where a specific attribute has a specific value. For example, I know how to select nodes "person" nodes which have a value of strID for attribute id;

Set oDOM = Server.CreateObject("MSXML2.DomDocument")
oDOM.loadXML strXML

Set oNodes = oDOM.selectNodes("/people/person[@id='" & strID & "']")

Now suppose person nodes also had an attribute name. How would I select "person" nodes where id has value strID and name has value strName?

Best Answer

Try this:-

Set oNodes = oDOM.selectNodes("/people/person[@id='" & strID & "' and @name='" & strName & "']")