XPath 1.0 to find if an element's value is in a list of values

Posted by user364902 on Stack Overflow See other posts from Stack Overflow or by user364902
Published on 2010-06-11T20:08:02Z Indexed on 2010/06/11 20:13 UTC
Read the original article Hit count: 151

Filed under:
|
|

Is there a way to construct an XPath that evaluates whether an element's value is in a predefined list of values? Something akin to this:

/Location/Addr[State='TX or AL or MA']

Which would match nodes whith State elements for Texas, Alabama, or Massachusetts? I know that I can unpack the expression:

/Location/Addr[State='TX] or /Location/Addr[State='AL'], etc...

But this is a bit cumbersome since the xpaths are quite long, as is the list of values. My google-fu isn't turning up much on the issue...

© Stack Overflow or respective owner

Related posts about list

Related posts about xpath