I am doing some HTML scraping and have hit a wall with this one query. I am trying to return a set of values from the following HTML page structure:
<div id="product-grid">
<ul>
<li><div class="price">Cash Price: $20.00</div></li>
<li><div class="price">Cash Price: $30.00</div></li>
<li><div class="price">Cash Price: $40.00</div></li>
</ul>
</div>
I am trying to get the "$20.00"
prices returned in a list. If I use the following XPath:
id('product-grid')//p[@class="price"]
I get a result list of all the "Cash Price: $40.00". If I try the following query:
substring-after(id('product-grid')//p[@class="price"] , "Price: ")
I get the correct output, but only get the first result. Anyone know how I can get all results?
I am running PHP5.3.3
with libxml 2.7.8
for the XPath
. I am calling the xpath as follows:
$xpath = new DOMXPath( $html );
$resultset= $xpath->query($query);
I have been googling like mad trying to find out why this is happening! Please help!