I'm fairly new to XPath, been fiddling around with it for a few hours now, so i'm not entirely sure if you can even do something like the following with it.
Okay, here's the scenario: I want to find a link from a page. That link is only recodnizable by it's text value, ie. the text between <a> tags (<a href="#">this link<a>). So far i've managed to get my hands on to link elements with that text, the only problem is that there's a few of those lying around.
These links are found from unordered lists which are preceded by another link tag, which would serve as a really good "anchor" point to begin the search for the final element that i want to find (ie. then i could just accept the first one that matches)
To clarify things a bit, here's an example of what's going on:
<a href="#">first dropdown menu</a>
<ul>
<li><a href="#">some link</a></li>
<li><a href="#">link i want to find</a></li>
</ul>
<-- And i would actually want to find the thing from this list -->
<a href="#">second dropdown menu</a>
<ul>
<li><a href="#">some link</a></li>
<li><a href="#">link i want to find</a></li>
</ul>
And i should probably specify, that i only want to receive either one result or a set of results with the first element being the "correct" element - the element i want to find.
EDIT: The question has been answered already, but there were some comments that i should specify this a bit more, so that people could actually understand the question ;)
So the idea was to use an element to specify the location of another element that could have duplicate search results scattered all around the document.
Essentially you would run into something like this if you wanted to find a given link from a group of dropdown menus that would have elements with same names or values.
That's basically it. I know that it's still a bit difficult to get the point, but unfortunately i'm having a hard time trying to explain it better. I'm sure that somebody else could do a better job and if that happens, i'm more than happy to include that description here.