XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition (564 page)

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
13.81Mb size Format: txt, pdf, ePub
ads

in French), and the choice of words or abbreviations equivalent to the English
p.m.
and
A.D.
.

Since the variety of calendars and numbering schemes that implementations might support is completely open ended, it's quite possible that the
language
attribute might be used in other ways than these, for example to decide between
IV
and
IIII
as the representation of the number 4 in Roman numerals.

Implementations are not required to support any particular languages, and the set of languages that are supported is likely to depend on the choice of calendar.

The Calendar Argument

The World Wide Web Consortium takes its name very seriously, and bends over backward to ensure that it caters to every society on the planet. While most of the Western world, and much of the Eastern world, now uses the Gregorian calendar first introduced in the sixteenth century, there are many other calendars still in use. The XSLT specification defines the following codes that you can use to represent different calendars.

Code
Calendar
AD
Anno Domini (Christian Era)
AH
Anno Hegirae (Muhammedan Era)
AME
Mauludi Era (solar years since Mohammed's birth)
AM
Anno Mundi (Jewish Calendar)
AP
Anno Persici
AS
Aji Saka Era (Java)
BE
Buddhist Era
CB
Cooch Behar Era
CE
Common Era
CL
Chinese Lunar Era
CS
Chula Sakarat Era
EE
Ethiopian Era
FE
Fasli Era
ISO
ISO 8601 calendar
JE
Japanese Calendar
KE
Khalsa Era (Sikh calendar)
KY
Kali Yuga
ME
Malabar Era
MS
Monarchic Solar Era
NS
Nepal Samwat Era
OS
Old Style (Julian Calendar)
RS
Rattanakosin (Bangkok) Era
SE
Saka Era
SH
Mohammedan Solar Era (Iran)
SS
Saka Samvat
TE
Tripurabda Era
VE
Vikrama Era
VS
Vikrama Samvat Era

This looks like a pretty impressive list, but before you get too excited that your favorite calendar is in the list, you should be aware that there is no requirement for implementations to support all these. And even if a calendar is supported, there are snags that you need to be aware of.

The date-formatting functions assume that the date and/or time will be represented using the types defined in XML Schema, which are based on the ISO 8601 specification. This doesn't mean that you have to be using a schema to take advantage of them, because you can always construct an instance of one of these types using a call to a constructor function; for example,
xs:date(“1999-11-16”)
. It does mean, however, that you have to ensure that your dates and times are in ISO format before you can use these functions. If your XML documents contain dates in nonstandard formats such as
16 NOV 99
or
11/16/1999
, then you are going to have to convert them first to the ISO format. And the same is true if your dates are in a different calendar.

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
13.81Mb size Format: txt, pdf, ePub
ads

Other books

Blush (Rockstar #2) by Anne Mercier
Water Witch by Deborah LeBlanc
Zombie Ocean (Book 3): The Least by Grist, Michael John
Comeback by Corris, Peter