RE: [xsl] some XPath please ?

Subject: RE: [xsl] some XPath please ?
From: "Fabien Tillier" <f.tillier@xxxxxxxx>
Date: Wed, 23 Jun 2010 10:45:10 +0200
Many thanks to Sheila, Michael and Andy.
It works now !

Best regards,
Fabien

-----Message d'origine-----
De : Michael Kay [mailto:mike@xxxxxxxxxxxx]
Envoyi : mercredi 23 juin 2010 10:21
@ : xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Objet : Re: [xsl] some XPath please ?

The != operator compares the values (content) of nodes, not their
identity or their name.

You could use //tag2[not(parent::tag1)]

or //*[not(self::tag1)]/tag2

Michael Kay
Saxonica

On 23/06/2010 07:51, Fabien Tillier wrote:
> Hi List.
> Suppose I get a (simple) XML
> <xml>
> <tag1>
>   <tag2>
>    <tag3/>
>    <tag3/>
>   </tag2>
>   <tag2>
>    <tag3/>
>    <tag3/>
>    <tag3/>
>   </tag2>
> </tag1>
> <tag2>
>   <tag3/>
>   <tag3/>
> </tag2>
> <tag2>
>   <tag3/>
>   <tag3/>
>   <tag3/>
> </tag2>
> </xml>
>
> What if I want to select all tag2 elements that did not have a tag1
> above ?
> I have tried
>
> "//tag2[parent::node!=3D'tag1']/*"
>
> But it gets all ...
>
> And
>
> "//tag2[parent::node!=3Dtag1]/*"
>
> Gets nothing
>
> (and I would prefer not using the higher level nodes like /xml/tag2
> against /xml/tag1/tag2)
>
> Thanks in advance !
> Regards,
> Fabien

Current Thread