Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: xpath: predicate to choose only elements that match a one of a list of values >Thread Next - Re: xpath: predicate to choose only elements that match a one of a list of values Re: xpath: predicate to choose only elements that match a one of a list of valuesTo: NULL Date: 7/3/2008 8:38:00 PM Phantom wrote: > slick 8^) however, won't this also match on crabapple and applebys? Nope. Note that he's concatenating a few non-name characters (space and comma) before doing the test. However, I *really* hate relying on testing localname and losing proper namespace-awareness. Bad habit to get into. If you really want to do it via a predicate, I'd suggest "//*[self::apple or self::orange]" which will walk the tree and return only those nodes which are apple or orange elements. However, "//apple | //orange" really should work. XPath defines the '|' character as the union operator. This expression should return every node that is either an apple or an orange. You say you're only getting the first hit -- but I think that means either you're misusing your XPath API by failing to retrieve results after the first, or it's broken and you should consider switching implementations. (You didn't show us the surrounding code, and I don't recognize the syntax, so I can't say much beyond that.) | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
