There is a section of amazon.com from which I want to extract the data (node value only, not the link) for each item.
The value I'm looking for is inside and <span class="narrowValue">
<ul data-typeid="n" id="ref_1000">
<li style="margin-left: -18px">
<a href="/s/ref=sr_ex_n_0?rh=i%3Aaps%2Ck%3Ahow+to+grow+tomatoes&sort=salesrank&keywords=how+to+grow+tomatoes&ie=UTF8&qid=1327603358">
<span class="expand">Any Department</span>
</a>
</li>
<li style="margin-left: 8px">
<strong>Books</strong>
</li>
<li style="margin-left: 6px">
<a href="/s/ref=sr_nr_n_0?rh=k%3Ahow+to+grow+tomatoes%2Cn%3A283155%2Cp_n_feature_browse-bin%3A618073011%2Cn%3A%211000%2Cn%3A48&bbn=1000&sort=salesrank&keywords=how+to+grow+tomatoes&ie=UTF8&qid=1327603358&rnid=1000">
<span class="refinementLink">Crafts, Hobbies & Home</span><span class="narrowValue">(19)</span>
</a>
</li>
<li style="margin-left: 6px">
<a href="/s/ref=sr_nr_n_1?rh=k%3Ahow+to+grow+tomatoes%2Cn%3A283155%2Cp_n_feature_browse-bin%3A618073011%2Cn%3A%211000%2Cn%3A10&bbn=1000&sort=salesrank&keywords=how+to+grow+tomatoes&ie=UTF8&qid=1327603358&rnid=1000">
<span class="refinementLink">Health, Fitness & Dieting</span><span class="narrowValue">(3)</span>
</a>
</li>
<li style="margin-left: 6px">
<a href="/s/ref=sr_nr_n_2?rh=k%3Ahow+to+grow+tomatoes%2Cn%3A283155%2Cp_n_feature_browse-bin%3A618073011%2Cn%3A%211000%2Cn%3A6&bbn=1000&sort=salesrank&keywords=how+to+grow+tomatoes&ie=UTF8&qid=1327603358&rnid=1000">
<span class="refinementLink">Cookbooks, Food & Wine</span><span class="narrowValue">(2)</span>
</a>
</li>
</ul>
How could I do this with XPath?
the code is from the link amazon kindle search
currently i am trying
$rank=array();
$words = $xpath->query('//ul[@id="ref_1000"]/li/a/span[@class="refinementLink"]');
foreach ($words as $word) {
$rank[]=(trim($word->nodeValue));
}
var_dump($rank);