<?php
$xml = <<< XHTML
<table>
<tbody>
<tr class="heading_table_top">
<th width="6%">SNo</th>
<th width="9%">Stn Code</th>
<th width="17%">Stn Name</th>
<th width="9%">Route No.</th>
<th width="9%">Arrival Time</th>
<th width="9%">Dep. Time</th>
<th width="15%">Halt Time (In Minutes)</th>
<th width="9%">Distance</th>
<th width="6%">Day</th>
<th width="20%">Remark</th>
</tr>
</tbody>
</table>
XHTML;
$dom = new DOMDocument;
$dom->loadXml($xml);
$xp = new DOMXPath($dom);
$nodes = $xp->evaluate(
'//table[descendant::th="Stn Code" and descendant::th="Route No."]'
);
foreach ($nodes as $node) {
echo $dom->saveXml($node);
}