I have to figure out a query string selecting item objects by date elements, comparing a year and/or month and/or day value to an integer value I provide by URl.
Problem is that date elements in my xml file are formatted like this:<date>Fri, 03 Aug 2012 11:56:58 GMT</date>
I would like to convert the date and do the comparison inside my querystring, without accessing the document.
Is it possible?
Or should I reformat all date elements using python's strptime() on the xml before I put it in my container?
What I have in mind is this sort of thing (obviously not working):
yrset = r"collection()/rss/channel/item[(time.strptime(pubDate,'%a %d %b %Y %H %M %S %Z').tm_year = year ) and enclosure/@url = key]"
A little update: I actually got by with a simple query that performs a replace on month names, this might be enough. What is looking ugly now is that i prepare and execute a separate query for each month name. I could not come up with a less unseemly way to group a multiple replace.
I took a shot at replace-multi(xquery) and format-dateTime(xpath 2.0) but I couldn'get them to work.
Recursive function maybe?
I want to replace a set of node values , returning them with the right number representing the month value instead of a name substring, e.g. 08 instead of Aug.
Sorry for my poor English and skills, I'm taking my time to learn.