xsl-list
[Top] [All Lists]

Re: [xsl] template to validate dates?

2007-04-10 01:50:22
On 4/9/07, Glen Mazza <grm7793(_at_)yahoo(_dot_)com> wrote:
Hello,

I have a requirement to convert dates from one format
to another.  There is additional complexity though: if
the date is invalid (say, March 42, 2007 or June 5,
20a02) to just return the invalid date.  (We are
taking the data and loading it into Oracle, if the
date format is invalid it will raise a database error
and we will handle it there.)

A date conversion template is not a problem--I've done
that multiple times in the past, but what is new for
me is trying to validate a date using XSLT functions.
Does anyone know of an available template somewhere on
the 'Net that will do such validation?

I'm not too sure what you are trying to achieve there, but if you want
to check if a date is valid then you could use "castable as" eg,

"'2007-04-30' castable as xs:date" returns true

"'2007-04-31' castable as xs:date" returns false

cheers
andrew

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>