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

Re: some XPath please ?

Subject: Re: some XPath please ?
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Wed, 23 Jun 2010 09:20:53 +0100
Re:  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

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.