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
13.35Mb 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

Traitor's Storm by M. J. Trow
Enemies of the Empire by Rosemary Rowe
Love's Deadly Touch by W. Lynn Chantale
Shackleton's Heroes by Wilson McOrist
Millionaire in a Stetson by Barbara Dunlop
Intrusion by Charlotte Stein
The Grand Ballast by J.A. Rock
Starship Fall by Eric Brown
A Grid For Murder by Casey Mayes