Search code examples
xmlxpathimport.io

XPath to ignore text within an element?


On this website: http://www.yankeecandle.com/browse/candles/jar-candles/_/N-9yfenter image description here

Using import.io to get data from the page.

I'm looking for an XPath that gets me only the lowest price, so the 10.99 and the 12.50.

enter image description here

I cant seem to NOT include the text in span.

.//div[@class="prod-details"]/p[3]

gets me all the price

.//div[@class="prod-details"]/p[3][not(span)]

ignores not only the span text, but also the text within the class="sl-prce price"

So the question is, can I get from the screenshot, the "sale 12.50" and NOT the 24.99 that is in the span.

Can this be done without applying Regex?


Solution

  • Try this XPath:

    //div[@class="prod-details"]/p[3]/text()