Sorry in advance if I don't explain this clearly. I will try my best to clarify what I am trying to do. Without further ado...Suppose you have a series of numbers on a page (separated by only a space) where brackets indicate the current page you are on.
It looks like this on the page:
[1] 2 3
The HTML looks like this:
<tr>
<td>
[<a href='link1.php'>1</a>] <a href='link2.php'>2</a> <a href='link3.php'>3</a>
</td>
</tr>
I am simply trying to select the next page number based on the current. I imagine I need to use some form of following-sibling but all I have come up with is //tr/td/a/following-sibling::a[1], which is obviously incorrect. It selects 2 when on page 1 but not 3 when on page 2 as expected. I would have tried to use a[text()[contains(.,'[')]] to select the current-page but the brackets are outside the anchor as opposed to inside. Eek!?
It would be much appreciated if you could explain the thought process along with your solution instead of just pasting the answer. Looking forward to your help.