XSLT and XPath

Mariusz Sieraczkiewicz

Usenet Archive
Joined
Aug 13, 2003
Messages
8
Reaction score
0
I have three variables: a, b, c.

And sample XML tree :

<parents>
<parent>
<child1>ssfd</child1>
<child2>dfoi</child2>
<child3>dijf</child3>
</parent>
............
<parent>
<child1>s34d</child1>
<child2>d44i</child2>
<child3>d342</child3>
</parent>
<parents>

how to write XPath expression that
returns the value of the child named c,
having sibling named a with value of b.
The start point is the 'parents' element.

Sample a = 'child1', b = 's34d', c='child3'

returns d342.

Regards.
 

Dimitre Novatchev

Usenet Archive
Joined
Nov 7, 2000
Messages
737
Reaction score
0
This is really a very simple expression.

I'd recommend getting and playing with the XPath Visualizer:

http://www.topxml/xpathvisualizer

Good books, which also cover XPath are:

1. "XSLT Programmer's Reference" by Michael Kay

2. "Beginning XSLT" by Jeni Tennison

=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

Mariusz Sieraczkiewicz said:
Thx, could you suggest some reading about such complex expressions?
Use:

/parents/parent/*
[name = $c
and
../*[name = $a] = $b
]

=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
 

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

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,799
Members
249,594
Latest member
henrywalsh

Latest Threads

Top