[xsl] format-date and xsd:date

Subject: [xsl] format-date and xsd:date
From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx>
Date: Mon, 9 Aug 2004 21:51:54 -0400
I'm not really sure where this question/comment ought to go, but since it came in the midst of working with XSTL 2, this seems a good place.

The data-typing-related support in XSLT 2 is based on XML Schema. So, in both cases, a "date" is defined as YYYY-MM-DD, and anything else is invalid. While this makes sense when you consider YYYY/MM/DD, MM-DD-YYYY and so forth, why can't all of the following be valid dates?

YYYY-MM-DD
YYYY-MM
YYYY

This comes out of working with bibliographic data, where one typically has issue dates of year-only, sometimes year-and-month, and only occasionally the full "date" as understood by xs:date.

This means I have to define my own schema patterns if I write a schema, and my own equivalents to handle the stuff in XSLT 2 if I don't want to select the substrings.

Does nobody else find this a problem? Is there any prospect to change it?

I'm just having a hard time understanding how I can code a schema to enforce dates of the sort I deal with and also get the advantage of the datatyping and XSLT 2 date formatting.

If I do:

<date year="1999" month="03"/>

... that's easy to control and flexible, but there's no format-month function (in Saxon 8 at least).

Bruce

Current Thread