Subject: RE: dateTime fun
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 21 Dec 2006 18:46:21 -0000
|
> So I'm dealing with a schema which has an attribute:
>
> <xs:simpleType name="time">
> <xs:union memberTypes="
> xs:gYear xs:gYearMonth xs:date xs:dateTime" />
> </xs:simpleType>
>
> I had to write a function to let someone compare two of these 'time'
> simple types. It appeared as though the only way to do
> comparisions was with equal times, so that mean converting
> everything to xs:dateTime.
For better or worse, the gXX types are very poorly supported by standard
functions and operators. I think the reason for this is that a lot of people
on the WGs felt that (a) these types were of very specialized interest
compared with other primitive types, and (b) date/time handling already had
far too big a share of the function library even without adding these to the
mix.
It's also true that union types aren't all that well supported in the type
system. You can declare a function that takes as="element(*,time)" or
as="attribute(*,time)" as an argument, but you can't say as="time" because
it's not an atomic type.
So I think I would probably end up with something fairly similar to your
solution.
Michael Kay
http://www.saxonica.com/
|