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 3481074
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:24:43+00:00 2026-05-18T10:24:43+00:00

I have a large table of data roughly laid out as follows. As requested

  • 0

I have a large table of data roughly laid out as follows. As requested below is a full sample rather than a simplification.

<table class="grid resultRaceGrid" id="mainGrid">
<tr>
    <th width="10">&nbsp;</th>
    <th>&nbsp;</th>
    <th>&nbsp;</th>
    <th>HORSE/SP</th>
    <th>AGE</th>
    <th>WGT</th>
    <th>TRAINER/JOCKEY</th>
    <th>OR</th>
    <th>TS</th>
    <th>RPR</th>
    <th width="10">&nbsp;</th>
</tr>
<tr>
    <td colspan="11" class="separator">&nbsp;</td>
</tr>
<tr>
    <td rowspan="2" class="last"><a href="/horses/result_home.sd?race_id=443557&amp;r_date=2007-11-21&amp;popup=yes" class="bull"><b>&laquo;</b></a></td>
    <td rowspan="2" class="nowrap noPad"><h3>1 </h3></td>
    <td rowspan="2" class="dstDesc"></td>
    <td class="nowrap"><span class="black"><a href="#" id="noteIcon_673823" class="pencil" onclick="return false;"><!-- --></a><b><a href="/horses/horse_home.sd?horse_id=673823" onclick="return popup(this, {width:695, height:800})" title="Full details about this HORSE">Andytown</a></b> (IRE) 6/4F <img src="http://ui.racingpost.com/ico/tipping-success.gif" class="shilda" title="Tipped by Topspeed" alt="" /></span></td>
    <td class="black">5</td>
    <td class="nowrap black"><span>11-1&nbsp;<span class="lightGray"></span></span></td>
    <td class="nowrap black"><a href="/horses/trainer_home.sd?trainer_id=13176" onclick="return popup(this, {width:695, height:800})" title="Full details about this TRAINER">N G Richards</a></td>
    <td rowspan="2" class="lightGray">&mdash;</td>
    <td rowspan="2" class="lightGray"><span class="red bold">*</span></td>
    <td rowspan="2" class="last"><span class="red bold">*</span></td>
    <td rowspan="2" class="last"><a href="/horses/result_home.sd?race_id=450083&amp;r_date=2008-03-08&amp;popup=yes" class="bull"><b>&raquo;</b></a></td>
</tr>
<tr>
    <td colspan="3"><span class="pedigrees">ch g <a href="/bloodstock/stallionbook/stallion_home.sd?horse_id=42337&amp;popup=1" onclick="return popup(this, {width:734, height:800})" title="Full details about this STALLION">Old Vic</a> - <a href="/bloodstock/dam_home.sd?horse_id=519458" onclick="return popup(this, {width:695, height:800})" title="Full details about this DAM ">Pitfire (IRE)</a> (<a href="/bloodstock/stallionbook/stallion_home.sd?horse_id=303796&amp;popup=1" onclick="return popup(this, {width:734, height:800})" title="Full details about this STALLION">Parliament</a>)</span></td>
    <td class="lightGray"><a href="/horses/jockey_home.sd?jockey_id=82320" onclick="return popup(this, {width:695, height:800})" title="Full details about this JOCKEY">Fearghal Davis</a><sup>5</sup></td>
</tr>
<tr class="rowComment hideComment">
    <td colspan="3">&nbsp;</td>
    <td colspan="7"><div class="commentText">   Went prominent 6th, challenged 2 out, soon ridden, narrow advantage last, forged clear towards finish (tchd 7-4)</div></td>
    <td>&nbsp;</td>
</tr>
<tr>
    <td colspan="11" class="separator">&nbsp;</td>
</tr>

I have the following XPath which allows me to correctly match an entire row of interest.

My question is: how can I select this tr together with the following two tr elements (following it).

$xpath->query("//table[@id='mainGrid']//tr[descendant::a[contains(@href,'horse_home')]]"
  • 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-18T10:24:43+00:00Added an answer on May 18, 2026 at 10:24 am

    Use:

    //table[@id='mainGrid']
          //tr[descendant::a
                  [contains(@href,'horse_home')]
              ]
     |
        //table[@id='mainGrid']
              //tr[descendant::a
                      [contains(@href,'horse_home')]
                  ]
                   /following-sibling::tr[not(position() > 2)]
    

    This XPath expression refines your previous selection, specifying that the union of it with at-most two tr following siblings (of your previous selected tr element) should be selected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just create a large table with more than 30 rows of data,
I have two tables in my database roughly laid out as below Client id
I have a large table with sales data, useful data below: RowID Date Customer
I have a rather large table data I need to print, but when I
I have a rather large (many gigabytes) table of data in SQL Server that
I have a large table of data (that displays test data) that is separated
I have one large database table of request data, much like Apache request logs,
I have a relatively large table (5,208,387 rows, 400mb data/670mb index), all columns i
I have a table with large amount of data and want to take too
I have a large data table that contains a checkbox for each row. I

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.