Xpath select an element outside the context
This is an open discussion with 2 replies, filed under XSLT.
Search
Try this: http://xpathr.com/view/2940230/faf9de4b4d0f148b13f81825392809ac8b6216c1/
My logic is a bit different so to answer your initial question how to match the title from gallery/item
: you'll first have to move up to the entry using ancestor::entry
and then go back down to title
– ancestor::entry/title
or ../../title
in this specific case.
Can't try it at the moment but this seems the solution.
Thanks Nils. I'll try it tonight
Create an account or sign in to comment.
I got the following xml:
The xslt is as follow:
Wanted result:
Title 1 image
Title 2 image
Title 2 image
But the title is out of the context form gallery/item so it only gives me Title 1.
I thought entry/preceding::title would do the trick. But it doesn't.