Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: XPath expression to find minimum/earliest date-time? [Thread Next] Re: XPath expression to find minimum/earliest date-time?To: NULL Date: 9/5/2007 9:29:00 AM I'm actually working with XSLT in BizTalk 2006, which unfortunately doesn't support XLST 2.0 with all its nice date-time functions. But I was able to write some scripting functions that do string comparisions, format my date-time values as sortable date-time strings, and call my custom min date-time functions from XSLT. Thanks, Zoe "Martin Honnen" <mahotrash@y...> wrote in message news:OwSuXZv7HHA.3716@T...... > 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 | |||
|
