title: Selecting from and including table rows that contain some text in xpath
body: <p>I'm new to Html Agility Pack and Xpath. I have a table part of which is:</p>
  
  <pre><code>                        ...
                          &lt;tbody class="tdata"&gt;
                          &lt;tr bgcolor="#ffffff"&gt;
                          &lt;td nowrap&gt;CRR004&lt;/td&gt;
                          &lt;td nowrap&gt;Carrie&lt;/td&gt;
                          &lt;td nowrap&gt;021&lt;/td&gt;
                          &lt;td nowrap&gt;COAL&lt;/td&gt;
                          &lt;td nowrap&gt;0.800&lt;/td&gt;
                          &lt;td nowrap&gt;55.000&lt;/td&gt;
                          &lt;td nowrap&gt;55.800&lt;/td&gt;
                          &lt;td nowrap&gt;FCR A&lt;/td&gt;
                          &lt;td nowrap&gt;&amp;nbsp;&lt;/td&gt;
                          &lt;td nowrap&gt;&amp;nbsp;&lt;/td&gt;
                          &lt;td nowrap&gt;&amp;nbsp;&lt;/td&gt;
                          &lt;/tr&gt;&lt;/tbody&gt;
  
                          ...
  
                          &lt;tbody class="tdata"&gt;
                          &lt;tr bgcolor="#ffffff"&gt;
                          &lt;td nowrap&gt;CRR004&lt;/td&gt;
                          &lt;td nowrap&gt;Carrie&lt;/td&gt;
                          &lt;td nowrap&gt;021&lt;/td&gt;
                          &lt;td nowrap&gt;COAL&lt;/td&gt;
                          &lt;td nowrap&gt;0.800&lt;/td&gt;
                          &lt;td nowrap&gt;99.500&lt;/td&gt;
                          &lt;td nowrap&gt;100.300&lt;/td&gt;
                          &lt;td nowrap&gt;FCL B&lt;/td&gt;
                          &lt;td nowrap&gt;&amp;nbsp;&lt;/td&gt;
                          &lt;td nowrap&gt;&amp;nbsp;&lt;/td&gt;
                          &lt;td nowrap&gt;&amp;nbsp;&lt;/td&gt;
                          &lt;/tr&gt;&lt;/tbody&gt;
  
                          &lt;tbody class="tdata"&gt;
                          &lt;tr bgcolor="#ffffff"&gt;
                          &lt;td nowrap&gt;CRR004&lt;/td&gt;
                          &lt;td nowrap&gt;Carrie&lt;/td&gt;
                          &lt;td nowrap&gt;034&lt;/td&gt;
                          &lt;td nowrap&gt;BONE&lt;/td&gt;
                          &lt;td nowrap&gt;0.100&lt;/td&gt;
                          &lt;td nowrap&gt;100.300&lt;/td&gt;
                          &lt;td nowrap&gt;100.400&lt;/td&gt;
                          &lt;td nowrap&gt;FCL B&lt;/td&gt;
                          &lt;td nowrap&gt;&amp;nbsp;&lt;/td&gt;
                          &lt;td nowrap&gt;&amp;nbsp;&lt;/td&gt;
                          &lt;td nowrap&gt;&amp;nbsp;&lt;/td&gt;
                          &lt;/tr&gt;&lt;/tbody&gt;
  
                          &lt;tbody class="tdata"&gt;
                          &lt;tr bgcolor="#ffffff"&gt;
                          &lt;td nowrap&gt;CRR004&lt;/td&gt;
                          &lt;td nowrap&gt;Carrie&lt;/td&gt;
                          &lt;td nowrap&gt;021&lt;/td&gt;
                          &lt;td nowrap&gt;COAL&lt;/td&gt;
                          &lt;td nowrap&gt;0.400&lt;/td&gt;
                          &lt;td nowrap&gt;100.400&lt;/td&gt;
                          &lt;td nowrap&gt;100.800&lt;/td&gt;
                          &lt;td nowrap&gt;FCL B&lt;/td&gt;
                          &lt;td nowrap&gt;&amp;nbsp;&lt;/td&gt;
                          &lt;td nowrap&gt;&amp;nbsp;&lt;/td&gt;
                          &lt;td nowrap&gt;&amp;nbsp;&lt;/td&gt;
                          &lt;/tr&gt;&lt;/tbody&gt;
  </code></pre>
  
  <p>Using Html Agility Pack, I can grab the entire table with:</p>
  
  <pre><code>doc.DocumentNode.SelectNodes("//tbody[@class='tdata']/tr")
  </code></pre>
  
  <p>But I only want to select from the row whose 8th column contains "FCR A" to the last row containing "FCL B". That is from row 2 to row 14.</p>
  
  <pre><code>CRR004  Carrie  540 SS  1.100   53.900  55.000               
  CRR004  Carrie  021 COAL    0.800   55.000  55.800  FCR A            
  CRR004  Carrie  124 SH  4.200   55.800  60.000               
  CRR004  Carrie  320 S SH    1.400   60.000  61.400               
  CRR004  Carrie  540 SS  2.400   61.400  63.800               
  CRR004  Carrie  320 S SH    0.300   63.800  64.100               
  CRR004  Carrie  540 SS  15.900  64.100  80.000               
  CRR004  Carrie  749 SS W/COAL STR   10.000  80.000  90.000               
  CRR004  Carrie  540 SS  7.200   90.000  97.200               
  CRR004  Carrie  124 SH  0.500   97.200  97.700               
  CRR004  Carrie  114 BLACK SH    1.800   97.700  99.500               
  CRR004  Carrie  021 COAL    0.800   99.500  100.300 FCL B            
  CRR004  Carrie  034 BONE    0.100   100.300 100.400 FCL B            
  CRR004  Carrie  021 COAL    0.400   100.400 100.800 FCL B            
  CRR004  Carrie  120 CL SH   0.800   100.800 101.600      
  </code></pre>
  
  <p>I tried <code>doc.DocumentNode.SelectNodes("//tbody[@class='tdata']/tr[following-sibling::td[8]='FCR A' and preceding-sibling::td[8]='FCL B']"))</code> among others to no avail. Any help will be very much appreciated. Thanks.</p>