XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Mark KaplanSubject: Xpath and the not operator
Author: Mark Kaplan
Date: 08 Aug 2006 02:49 PM
Originally Posted: 08 Aug 2006 02:48 PM
I am trying to find a path in an xml document only having an id that satisfy two different paths. With the xml file that looks like:

<x>
<y id = 'aaa'/>
<z>
<a id = 'aaa'/>
</z>
</x>

I use the xpath statement “//*[@id='aaa']” which returns two nodes and . I want to use an xpath statement that will return but not . I think this can be done using the “not” operator but I could not figure out the correct xpath syntax. If it matters, I am using the xpath in C# code with the call SelectNodes().

Thanks for any help.

Mark

Postnext
Ivan PedruzziSubject: Xpath and the not operator
Author: Ivan Pedruzzi
Date: 08 Aug 2006 03:14 PM
Mark,

Your email account doesn't match any Stylus Studio registered user.
This forum is only for the Stylus Studio users community.

Ivan Pedruzzi
Stylus Studio Team
http://www.stylusstudio.com/xml_download.html

Postnext
Mark KaplanSubject: Xpath and the not operator
Author: Mark Kaplan
Date: 08 Aug 2006 03:30 PM
Ivan,

I am a licensed user of Stylus Studio. How do I become a registered user of this forum. It is possible that I used the email address of mkaplan@phaseforward when I registered the product and not my yahoo account.

Mark

Postnext
Ivan PedruzziSubject: Xpath and the not operator
Author: Ivan Pedruzzi
Date: 08 Aug 2006 03:52 PM

You can match a specific node, for instance match any y with id equal to "aaa"

//y[@id='aaa']

or more selectively

/x/y[@id='aaa']


Hope this helps
Ivan Pedruzzi
Stylus Studio Team
http://www.stylusstudio.com/xml_download.html

Postnext
Mark KaplanSubject: Xpath and the not operator
Author: Mark Kaplan
Date: 08 Aug 2006 03:58 PM
I do not know the specific node names. I only know the id value. That is why I am using //*[id='aaa']. The problem that I am having is that I want to exclude node <a> while retrieving node <y>

Thanks,
Mark

Postnext
Ivan PedruzziSubject: Xpath and the not operator
Author: Ivan Pedruzzi
Date: 08 Aug 2006 04:02 PM

Sorry I missed that

Try

/*[local-name() != 'a' and @id = 'aaa']




Ivan Pedruzzi
Stylus Studio Team
http://www.stylusstudio.com/xml_download.html

Posttop
Mark KaplanSubject: Xpath and the not operator
Author: Mark Kaplan
Date: 08 Aug 2006 04:16 PM
Thanks

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.