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 valuesTo: NULL Date: 7/3/2008 9:08:00 PM
On 2008-07-03 02:16:28 -0700, Bjoern Hoehrmann <bjoern@h...> said:
> * 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`.
nope, that only returns the first hit for me (apple).
>
>> 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 mean, it would function, but I can't go there... there might be 20
fields posted, I need something more straightforward than assembling an
OR predicate each time I call the xpath.
>
>> 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.
thanks for the lead, but they don't cover this example, and they don't
provide much in the way of examples.
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
