[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Testing / Comparing dates

Subject: RE: Testing / Comparing dates
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 24 Mar 2006 11:22:55 -0000
how to compare dates
In 2.0 you can compare dates directly. If there's a schema that defines
submissionDeadline to be a date, you just do

submissionDeadline > current-date()

If not, you just cast it:

xs:date(submissionDeadline) > current-date()

In 1.0 you're stuck with numeric comparison. You can do

number(transate(submissionDeadline), '-', '') > $currentDate

where $currentDate is a parameter in the format 20060323

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: Aaron Johnson [mailto:Aaron2.Johnson@xxxxxxxxx]
> Sent: 24 March 2006 11:00
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Testing / Comparing dates
>
> Hello...
>
> I have some xml:
>
> <submissionDeadline>2006-17-12</submissionDeadline>
>
> I would like to test this element against a parameter
> containing the current
> date so as to display two lists, a list of items on time and
> a list of items
> that are late.
>
> As far as I am aware, the parameter will be the same format.
>
> I thought if the dates were passed as integers [20061712] it
> may be possible
> to do a greater than of less than test.
>
> Can you compare dates as they are in this form, and if so, how?
>
> Thanks for your advice...
>
> ..................................................................
>
> Aaron Johnson
> GUI / XSLT development
> Academic Technologies Group [ATG]
> University of the West of England
> 0117 3281051 [ext: 81051]
> atg.uwe.ac.uk/aaron
>
> SECURITY POLICY:
>
> Please note that ATG will only accept
> e-mail attachments in the following
> formats:
>
> .asp,.bin,.doc,.gif,.html,.jpg,.mdb,.png,
> .psd,.shtml,.sdf,.sit,.xls,.xml,.xsd,.xsl,.zip,
>
> ..................................................................
>
> 3In a wireless world without boundaries...
> ...who needs Gates and Windows?2
>
> ..................................................................
>
> This communication is intended solely
> for the use of the individual(s) to whom
> it is addressed. Any opinions presented
> are those of the author and do not
> necessarily represent the University of
> the West of England, Bristol.
> ..................................................................
>
>
>
> This email has been independently scanned for viruses and any
> virus software has been removed using McAfee anti-virus software

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.