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

  • Home
  • SEARCH
  • 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 6928125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:08:37+00:00 2026-05-27T11:08:37+00:00

based on this HTML: < table width=’300′ ……> <tbody> < tr> < td class

  • 0

based on this HTML:

< table width='300' ......>
 <tbody>
  < tr>
   < td class = 'wcheader1'> ..... </td>
  < /tr>
  < tr>
   < td class = 'wccontnetbox'>......< /td>
  < /tr>
  < tr>
   < td class = 'wccontnetbox'>......< /td>
  < /tr>
  < tr>
   < td class = 'wcheader1'> ..... </td>
  < /tr>
  < tr>
   < td class = 'wccontnetbox'>......< /td>
  < /tr>
  < tr>
   < td class = 'wccontnetbox'>......< /td>
  < /tr>
  < tr>
   < td class = 'wcheader1'> ..... </td>
  < /tr>
  < tr>
   < td class = 'wccontnetbox'>......< /td>
  < /tr>
  < tr>
   < td class = 'wccontnetbox'>......< /td>
  < /tr>
 </tbody>
</table>

I have trouble selecting only the first two <td class='wccontnetbox'> elements after the first <td class='wcheader1'> element. Is there an XPath expression to do this?

UPDATE: those elements are dynamic.

  • 1 1 Answer
  • 0 Views
  • 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-27T11:08:38+00:00Added an answer on May 27, 2026 at 11:08 am

    Use the following expression to select the first two wccontnetbox elements after the first wcheader1:

    //table/tbody/tr[td[@class='wcheader1']][2]/
        following-sibling::tr[td[@class='wccontnetbox']][position()<3]/td 
    

    I’m using // because you don’t show your full input. It would be better to use a direct path to the table (e.g. /html/body/<etc>/table...).

    Use the following expression to select all nodes between the first and second wcheader1 elements:

    //table/tbody/tr[td[@class='wcheader1']][1]/following-sibling::tr[
        count(.|//table/tbody/tr[td[@class='wcheader1']][2]/preceding-sibling::tr)
         =
        count(//table/tbody/tr[td[@class='wcheader1']][2]/
            preceding-sibling::tr)]/td[@class='wccontnetbox']
    

    Note: This second expression uses the Kayessian node-set intersection formula. In general, use the following expression to find the intersection of $set1 and $set2:

    $set1[count(.|$set2)=count($set2)]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seeing this: http://www.suckless.org/wiki.html . A wiki based on Mercurial. Are there any other non-code
I'll preface this question by stating I have historically used tables for my HTML
I have the following table: <table> <tr> <td style=height: 7px; width: 7px> A1 </td>
I have a table with expand/collapse javascript acting on the class value assigned to
Possible Duplicate: xpath select elements between two nodes based on this html i need
I would like to create an HTML table with row colors changing based on
I have the following HTML <table id=tbl1> <!-- Table row trHeader should be here
I have a table with one row in my HTML file. Now in jQuery
This code works like a charm to show/hide table rows based on selected filters.
I'm building a pretty basic HTML table creator/editor (based on a designMode iframe) at

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.