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

Forgiving Patience by Jennifer Simpkins
Darkness Dawns by Dianne Duvall
Irish Melody by Caitlin Ricci
Beauty by Daily, Lisa
Shades of Gray by Spradling, Carol A.
The Duel by Anton Chekhov
The Stone Gallows by C David Ingram
Lovers Meeting by Irene Carr