[xsl] Re: RE: Re: RE: Re: XPath riddle

Subject: [xsl] Re: RE: Re: RE: Re: XPath riddle
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 5 Jul 2001 05:28:19 -0700 (PDT)
Nikolaos Giannadakis wrote:

> in the context of xml schemas, DIFFERENT element declarations with the same
> name (and possibly ancestors) may appear within different scopes. Let then
> be a recursive XML Schema definition. The problem appears when one wants to
> select specific nodes in an XML file conforming to this recursive schema. In
> particular, all other nodes (with the same name etc -but declared within
> other elements-) will be returned as well.

Now, if I understand you well, you want every D/C, for which the first ancestor from
a given list of ancestors (the list of elements defining D and its child C as
descendents) to be "A" and nothing else.

Then this is returned by:

//D/C[name(ancestor::*[name()='A' or name()='F'][1])='A']

Here I'm supposing that "A" and "F" are the only two elements, for which "D" with
child "C" have been defined in the schema.

In case there are more such elements defining D/C and their names are provided as
(e.g.) space-delimited list $listOfDefiningEls, then this more general expression
will be:

//D/C[name(ancestor::*[contains($listOfDefiningEls, concat(' ', name()))][1])='A']

Dimitre Novatchev.

Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread