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

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

Specifying leading zeros in the formatting token is regarded as a shorthand for the width modifier: for example,
01
is a shorthand for
1,2-2
. For most numeric fields, the width specified controls whether leading zeroes are output: if the minimum width is 2, then the value 8 will be output as 08. The year field is treated specially: a maximum width of 2 indicates that the century should be omitted. The fractional seconds are also handled differently: the minimum and maximum width indicate the minimum and maximum number of decimal places to be output.

For named fields, such as the name of the month and the day of the week, the width modifier controls the choice of abbreviations. For example, specifying
3-3
requests abbreviations that are exactly three characters long. The specification doesn't say exactly how the abbreviations should be chosen; some systems might use a dictionary of abbreviated forms (for example JLY for July), while others might use simple truncation of the full name. Names should be padded to the minimum length if they are shorter.

It's an error to request output of a field that isn't applicable to the type of input value; for example, component
H
for a date, or
Y
for a time. (It's alright, however, to ask for the timezone to be displayed when the value contains no timezone: the relevant component will simply be omitted.)

The Language Argument

The
language
argument defines the language to be used for those parts of the output date that are language dependent. The most obvious examples are the names of the days of the week and the months of the year: for example, if the value is
en
then a date might be output as
Sunday 13 December 1987
, while with
de
(the code for German) the same date would be
Sonntag 13 Dezember 1987
. The choice of language is also likely to affect the way the ordinal numbers are represented (
4th
in English,
4.
in German, and
4éme

Other books

Beneath Ceaseless Skies #27 by Lee, Yoon Ha, McHugh, Ian, Harvey, Sara M., Ashley, Michael Anthony
The Switch by Elmore Leonard
The Palace of Dreams by Ismail Kadare, Barbara Bray
Hot Sleep by Card, Orson Scott
Along for the Ride by Michelle M Pillow
The Sigma Protocol by Robert Ludlum
Bittersweet Darkness by Nina Croft