Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: xpath: predicate to choose only elements that match a one of a list of values

From: Bjoern Hoehrmann <bjoern@---------.-->
To: 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/ 


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent