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

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

Effect

If the
value
argument is an empty sequence, then the result is an empty sequence.

The Picture Argument

The
picture
argument consists of a string containing so-called variable markers enclosed in square brackets. Characters outside the square brackets are literal characters to be copied to the result; variable markers within the square brackets indicate components of the date and time to be added to the output string, and the format in which they are to be displayed.

If square brackets are needed as literal characters in the result they should be doubled.

For example, if the
picture
is given as
[D1]/[M1]/[Y1,4]
then the date 1 February 2008 will be displayed as
1/2/2008
.

Each variable marker consists of a
component specifier
identifying which component of the date or time is to be displayed; an optional
formatting token
; an optional
presentation modifier
; and finally, an optional
width modifier
, preceded by a comma if it is present.

The components of the date and time are identified by the following letters:

Letter
Component
Default Format
Y
Year
Four digits
M
Month of year
Numeric 1–12
D
Day of month
Numeric 1–31
d
Day of year
Numeric 1–366
F
Day of week
Name of day (language dependent)
W
Week of year
Numeric 1–53
w
Week of month
Numeric 1–5
H
Hour (24 hours)
Numeric 00–23
h
Hour (12 hours)
Numeric 1–12
P
A.M. or P.M.
Alphabetic (language dependent)
m
Minutes in hour
Numeric 00–59
s
Seconds in minute
Numeric 00–59
f
Fractional seconds
Numeric, one decimal place
Z
Timezone
Numeric, for example +08:00
z
Timezone
GMT+n
C
Calendar
Name of calendar, for example
Old Style
E
Era
Text or abbreviation describing the baseline from which the year is calculated, for example
A.D.
or the name of a monarch

The formatting token consists of one or more additional letters or digits. The value can be either a formatting token recognized by the

instruction (see page 403 in Chapter 6), or one of the values
N
n
, or
Nn
indicating that the component is to be output by name. Ignoring values such as
a
and
A
that are unlikely to be useful, at least in English, this leaves the following as examples of the possibilities.

Other books

The Golden Eagle Mystery by Ellery Queen Jr.
The First Rule of Ten by Gay Hendricks and Tinker Lindsay
Caught by Jami Alden
Sent to the Devil by Laura Lebow
North of Montana by April Smith
The Rain by Joseph Turkot
Shadows In Still Water by D.T. LeClaire
Reckless Heart by Barbara McMahon
Miriam and the Stranger by Jerry S. Eicher