You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by th...@ascentialsoftware.com on 2002/08/31 00:35:51 UTC

An XSLT/Xpath question

This is probably not the best mailing list to send such question but I am
not sure where I can get help.
I am trying to 

Let's say that I have an XML document looking like that:

<root>
  <A name="a1"><B .../></A>
  <A name="a2"><B .../></A>
  <A name="a3"><B .../></A>
  <C aRef="a1"/>
  <C aRef="a2"/>
</root>

I want to be able to select all the B element which are under the A elements
referenced by the C element (the A elements for which a C/@aRef attribute
value is equal to the A/@name attribute).
I have the impression of missing something like being able to test if a
string is contained in a set of string: I'd like to write something like
that: //A[@name in (//C/@aRef)]/B 
Obviously the 'in' operator does not exist, and the //C/@aRef node set gets
very easily converted into just the first text node of the list.
Trying with imbricate for-each and some variable does not do it either as I
did not find a way to really "build" the resulting node set composed of the
B element.

Any help will be appreciated.

Thanks.

Thomas