xsl-list
[Top] [All Lists]

Re: [xsl] format-date() and negative (BCE) dates

2014-05-06 18:16:14

On 6 May 2014, at 23:53, Martin Holmes 
gtxxgm-xsl-list-2(_at_)m(_dot_)gmane(_dot_)org 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

Consider this BCE date:

 -0001-12-29

This date is in fact ambiguous. In ISO 8601, and in XSD 1.1, this is the date 
two years before 0001-12-29. In XSD 1.0, it is the date one year before 
0001-12-29.

XPath 2.0 refers to XSD 1.0. XPath 3.0 allows the implementation to use either 
XSD 1.0 or XSD 1.1.

If I format this using the "AD" (Gregorian) calendar, like this:

 format-date(xs:date('-0001-12-29'),
   '[Y0001]-[M01]-[D01]', (), 'AD', ())

I get an invalid date:

 0000-12-29

There is no year zero in the Gregorian calendar. I get the same results using 
OS (Julian). What am I doing wrong here? The ISO calendar does have a year 
zero. If I include the E (Era) component in the picture string, I do get 
"BC", but I don't see why the correct negative-one year is being changed to 
an incorrect zero-year.

This is using Saxon 9.4 (the one distributed with Oxygen 15.2).


I think Saxon tries to do this according to whether or not XSD 1.1 is enabled. 
But it's likely to be not very thoroughly tested.

The statement that "there is no year zero in the Gregorian calendar" is 
inaccurate. I don't think the papal bull which is the normative specification 
of the Gregorian calendar made any statement on the matter (though I admit I 
haven't consulted it, and my Latin is probably not good enough to make much 
sense of it anyway). Historians generally use the Jullian calendar when 
referring to events prior to the introduction of the Gregorian calendar. The 
only definitive statement I know of that extends the Gregoran calendar into the 
past is ISO 8601, and this states that there IS (or WAS) a year zero. 

Michael Kay
Saxonica
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

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