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

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

Changes in 2.0

The
select
attribute has been added: This allows a node other than the context node to be numbered.

XSLT 2.0 defines error conditions that must be reported when incompatible attributes are used (for example,
level
and
value
cannot appear together). In XSLT 1.0, redundant attributes were silently ignored. XSLT 2.0 also defines the result of the instruction more precisely in corner cases, for example when there is no node that matches the
from
pattern.

New options have been added in XSLT 2.0 for formatting numbers as words (so you can output
Chapter
Three
) and as ordinal numbers (so you can output
Fit
the
First
or
3rd
Act
).

Format

  value? = 
expression

  select? = 
expression

  level? = “single” | “multiple” | “any”

  count? = 
pattern

  from? = 
pattern

  format? = { 
string
 }

  lang? = { 
nmtoken
 }

  letter-value? = { “alphabetic” | “traditional”}

  ordinal? = { 
string
 }

  grouping-separator? = { 
char
 }

  grouping-size? = { 
number
 }  />

Position


is an instruction. It is always used within a sequence constructor.

Attributes

Name
Value
Meaning
value
optional
XPath Expression
A user-supplied number to be formatted (instead of using a node sequence number).
select
optional
XPath Expression
Selects the node whose sequence number is to be output (by default, the instruction numbers the context node).
level
optional
single
,
multiple
or
any
Controls the way in which a sequence number is allocated based on the position of the node in the tree.
count
optional
Pattern
Determines which nodes are counted to determine a sequence number.
from
optional
Pattern
Determines a cut-off point, a point in the document from which sequence numbering starts afresh.
format
optional
Attribute value template returning a format string, as defined below
Determines the output format of the number.
lang
optional
Attribute value template returning a language code, as defined in XML for the
xml:lang
attribute
Indicates a language whose conventions for number formatting should be used.
letter-value
optional
Attribute value template returning
alphabetic
or
traditional
Distinguishes between different numbering schemes used with the same language.
ordinal
optional
Attribute value template returning a string
If the attribute is present and is not a zero-length string, it indicates that ordinal numbering is required. For English, a suitable value is
yes
; for inflected languages, it indicates the required ending; for example,
-o
or
-a
in Italian.

Other books

Turning Payne by Chantel Seabrook
Betina Krahn by The Unlikely Angel
The Memory by Barbara Kaylor
Death of a Liar by M. C. Beaton
Lost Alpha by Ryan, Jessica
The Goblin War by Hilari Bell
Tale of the Dead Town by Hideyuki Kikuchi
A Conspiracy of Ravens by Gilbert Morris