Select on multiple criteria with XPath
Posted
by Matt Thrower
on Stack Overflow
See other posts from Stack Overflow
or by Matt Thrower
Published on 2010-04-08T10:49:21Z
Indexed on
2010/04/08
10:53 UTC
Read the original article
Hit count: 426
xpath
|xpath-expression
I have an XML document which looks something like this:
<meadinkent>
<record>
<comp_div>MENSWEAR</comp_div>
<sty_ret_type>ACCESSORIES</sty_ret_type>
<sty_pdt_type>BELTS</sty_pdt_type>
<pdt_category>AWESOME_BELTS</pdt_category>
</record>
<medinkent>
I want to useXPath to select nodes which match all four elements and I'm having trouble getting the boolean syntax right. I'm trying this to match the first two just as a test:
"/meadinkent/record/comp_div[.='" & comp_div & "'] and /meadinkent/record/sty_ret_type[.='" & sty_ret_type & "']"
Which is failing, saying no nodes are returned. Obviously I'm being very stupid - what am I doing wrong?
Cheers, mAtt
© Stack Overflow or respective owner