It sounds like you're trying to mix CSS selectors with XPath. You want to use the predicate ( [...] ) looking at the value of the class attribute.
For example, your //div.link might look like //div[contains(concat(' ',normalize-space(@class),' '),' link ')] .
Secondly, in a loop, you try to make a request with a node context, and then ignore it using the absolute location path (it starts with a slash).
Updated to reflect changes in the question:
Your second XPath expression ( /div[@class=link] ) is still a) absolute, and b) has the wrong condition. You want to request the appropriate elements relative to the specified node ( $entry ) context with the class attribute having the string value link .
So, /div[@class=link] should become something like a div[@class="link"] , which is looking for $entry child elements (use .//div[...] or descendant::div[...] if you want to search deeper).
salathe
source share