[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to select either ElementA -OR- ElementB in an

Subject: Re: How to select either ElementA -OR- ElementB in an axis
From: Eric van der Vlist <vdv@xxxxxxxxxxxx>
Date: Wed, 15 Jun 2005 21:38:13 +0200
Re:  How to select either ElementA -OR- ElementB in an
Hi,

On mer, 2005-06-15 at 12:25 -0700, Christopher R. Maden wrote:
> chris wrote:
> > Thanks for the response.  Are you sure that's correct or am I goofing
> > it up somehow?  Using Saxon 8.4, I get an error trying to use your
> > solution...
> 
> No, that won't work.  You need to look at all your ancestors, then find
> the closest one that matches your pattern:
> 
> ancestor::*[name() = 'A' or name() = 'B'][1]

Using name() = 'A' is not namespace safe and self::A should be preferred
in such situations :

ancestor::*[self::ElementA | self::ElementB][1]

Also note that the order of the ancestor axis can be misleading since
you'll get the first one starting from the context node going toward the
document root.

Eric

> 
> HTH,
> Chris
-- 
Curious about Relax NG? Read my book online.
                                   http://books.xmlschemata.org/relaxng/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(ISO) RELAX NG   ISBN:0-596-00421-4 http://oreilly.com/catalog/relax
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.