(Xpath) Select products based on <lastupdated>

131 Views Asked by At

I'm using a wordpress datafeed plugin to pull this Commission Junction feed. The plugin allows me to filter products by using Xpath.

<product>
  <programname>GamersGate</programname> 
  <catalogname>Gamersgate Product Catalog</catalogname> 
  <lastupdated>08/02/2013</lastupdated>
  <name>Reign: Conflict of Nations</name> 
  <keywords>reign conflict of nations, strategy</keywords>  
  <currency>USD</currency> 
  <price>6.80</price> 
  <buyurl>myurl</buyurl>  
</product>

I want to only filter in products that have been updated in the last two days.The plugin support staff told me that in order to do so, I had to change the dates to ISO format (yyyy-mm-dd), after that, the XPath would be:

/product[number(translate(lastupdated,'-','')) >= 20130801 and number(translate(lastupdated,'-','')) <= 20130802]

I have two questions about this Xpath.

Is that the best solution for filtering products based on <lastupdated>?

I was curious if it was even possible for it to automatically adjust the date range so that I don't have to manually change the Xpath every day, but they said there was no way around it. Is that totally out of the question?

0

There are 0 best solutions below