Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - 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 11:16:00 AM
* Phantom wrote in comp.text.xml:
>I need to write an xpath query string that returns one or more specific
>elements on the fly, in this example, apple and/or orange. *this* works
>for JUST apple:
>
>select xpath_eval('//apple',
So use `//apple | //orange`.
>Both the source and the match value are coming in at run time, so a
>series of OR clauses in the predicate won't work:
>
>noGoExample: [local-name()="apple" or [local-name()="orange"]
Well here you have more [ than ] which usually is a syntax error. Use
//*[local-name() = 'apple' or local-name() = 'orange']
>I KNOW there's a simple representation for this, but just try looking
>for it online when you don't know what you're looking for. like looking
>for a word in the dictionary you don't know how to spell.
http://www.w3.org/TR/xpath has many examples, and contains everything
there is to know about XPath 1.0.
--
Björn Höhrmann · mailto:bjoern@h... · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
