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: "Joseph J. Kesselman" <keshlam-nospam@-------.--->
To: 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.)



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