Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XPath expression to find minimum/earliest date-time?

From: Martin Honnen <mahotrash@-----.-->
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/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent