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

RE: Working with xs:date and xs:gYearMonth

Subject: RE: Working with xs:date and xs:gYearMonth
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 23 Jun 2004 15:00:33 +0100
xml xs date
>     Michael> <xsl:variable name="first-of-previous-month"
>     Michael> select="xs:date('0000-01-01') + ($previous-month *
>     Michael> $one-month)" as="xs:date"/>
> 
> Well, Saxon 8.0 doesn't allow this (quite right too - there never was
> a year zero!).

Actually, this is a minor disaster in XML Schema: in the proleptic Gregorian
calendar as defined by ISO 8601:2000 the year before 0001 is indeed 0000,
but in XML Schema it is -0001.

The fact that there was never a year zero is rather irrelevant; there was
never a year -1 either.  The numbers we use were assigned to these years
posthumously!

Saxon's date arithmetic on BC dates is probably unreliable because of these
problems, it's not something that is very well tested. It would be safer to
use a later date as a baseline.

> I tried substituting -0001-01-01, which saxon doesn't 
> complain of, but 
> date='{first-of-previous-month}'"
> is coming out as date=''.

Missing "$" perhaps?

Michael Kay


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.