Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 596189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:08:42+00:00 2026-05-13T16:08:42+00:00

Sorry in advance if I don’t explain this clearly. I will try my best

  • 0

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.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T16:08:42+00:00Added an answer on May 13, 2026 at 4:08 pm

    The next page after 2, will be found by:

    //tr/td/a[.='2']/following-sibling::a[1]
    

    First we select the current page based on its string content //tr/td/a[.='2'], and from there select the first following-sibling.

    To do this without knowing the current page, we will instead select the a element following the “]”.

    //tr/td/text()[']'=normalize-space(.)]/following-sibling::a[1]
    

    And in case that there is no current page, we will default to the first a element.

    //tr/td/( text()[']'=normalize-space(.)]/following-sibling::a | a )[1]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if this is base, I don't know much about Symfony. I'm trying to
I'm sorry, I don't know how to ask this question without giving you the
Hye! This is my first question here, so sorry in advance if I don't
Sorry in advance for this being such a beginner question. Here are the steps
Sorry in advance everyone for this question as I know the cascading select boxes
I am new to JPA and JBoss, so sorry in advance if this is
Sorry if this is too simple, but thanks in advance for helping. This is
Sorry, I know this question is easy, but I don't know how to get
I'm sorry in advance if this question is flawed. I'm pretty new to databases(I
I don't know how to phrase the question properly so sorry in advance. Using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.