XPATH expression.

R

Remi COCULA

Please help me find a XPATH expression.

I'm searching to locate all preceding "cousin" nodes of a context element
node of type foo.
(cousin = nodes with same grandfather).

The expression '../../descendant::foo' gives me all foo nodes with the same
grandfather of the courant node.
But I don't know how to get only the ones preceding the courant node.
 
D

Dimitre Novatchev

Remi COCULA said:
Please help me find a XPATH expression.

I'm searching to locate all preceding "cousin" nodes of a context element
node of type foo.
(cousin = nodes with same grandfather).

The expression '../../descendant::foo' gives me all foo nodes with the same
grandfather of the courant node.
But I don't know how to get only the ones preceding the courant node.


Use:

preceding-sibling::foo | ../preceding-sibling::*/foo


Dimitre Novatchev.
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top