XPath problem to be solved

J

Jean-Gael GRICOURT

Here is my xpath problem:

<AAA>
<BBB>
<CCC>Bye</CCC>
<DDD>Mr Hyde</DDD>
</BBB>
<BBB>
<CCC>Hello</CCC>
<DDD>Mr Bean</DDD>
</BBB>
</AAA>

How do I select "Mr Bean" knowing that it is in a node located next to
<CCC>Hello</CCC> node ?

I tried those xpath expressions with no success so far:

/AAA/BBB/CCC['Hello']/parent::BBB/DDD
/AAA/BBB/CCC['Hello']/following-sibling::DDD

I wish it returned "Mr Bean" instead of "Mr Hyde" ...

Any help will be much appreciated
 
R

Richard Tobin

Jean-Gael GRICOURT said:
/AAA/BBB/CCC['Hello']/following-sibling::DDD

['Hello'] doesn't test for the text content being 'Hello'.
But [. = 'Hello'] does.

-- Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,196
Latest member
ScottChare

Latest Threads

Top