HighTechTalks DotNet Forums  

back referencing?

Dotnet XML microsoft.public.dotnet.xml


Discuss back referencing? in the Dotnet XML forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Mystagogue
 
Posts: n/a

Default back referencing? - 12-06-2007 , 02:11 PM






Is it possible for a single xpath expression, perhaps using back-
referencing, to return the only the "item" elements having a "result"
that matches the parent "foo result"?

<foo result="false" >
<item id="1" result="true"/>
<item id="2" result="false/>
</foo>

In other words, I want to have the element with id="2"
returned...because it has the same result attribute as its parent. I
can accomplish that with two xpath statements, but how about just one?

Reply With Quote
  #2  
Old   
Oleg Tkachenko
 
Posts: n/a

Default Re: back referencing? - 12-06-2007 , 03:04 PM







Sure you can navigate back with XPath. You can use parent:: (.. for
short) or ancestor:: axes.

What you need here is /foo/item[@result = ../@result]

--
Oleg

Mystagogue wrote:
Quote:
Is it possible for a single xpath expression, perhaps using back-
referencing, to return the only the "item" elements having a "result"
that matches the parent "foo result"?

foo result="false"
item id="1" result="true"/
item id="2" result="false/
/foo

In other words, I want to have the element with id="2"
returned...because it has the same result attribute as its parent. I
can accomplish that with two xpath statements, but how about just one?

Reply With Quote
  #3  
Old   
Mystagogue
 
Posts: n/a

Default Re: back referencing? - 12-06-2007 , 06:45 PM



Havn't tried it yet, but thanks! That seems quite sensible.



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.