Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - XPath expression to find minimum/earliest date-time? >Thread Next - Re: XPath expression to find minimum/earliest date-time? Re: XPath expression to find minimum/earliest date-time?To: NULL Date: 9/4/2007 3:20:00 PM Zoe Hart wrote: > I've written a function to convert a date to number of ticks, but since > finding the minimum date involves comparing an individual date (or number of > ticks) to a node set, I'm not sure how to get the whole node set converted > to number of ticks in order for the comparison to work. > > Any suggestions? Can you use XSLT? I don't think pure XPath 1.0 suffices. You can do e.g. number(translate(value, '-T:', '')) to get a number your could compare, not even needing a function to convert to ticks but the problem with applying that function to a node-set with your original minimum approach remains. XPath 2.0 could do it nicely, besides having xs:dateTime support for comparison operators and the min functio I think you can even apply functional expressions to node-sets as the last part of an XPath expression so there you could do min(/test/order/item_info/item/somedata/value/xs:dateTime(.)) -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
