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.29Mb 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

A Year & a Day by Virginia Henley
Broken Cheaters by Lacey Silks
Death of a Dreamer by Beaton, M.C.
Thicker Than Blood by Annie Bellet
Magical Weddings by Leigh Michaels, Aileen Harkwood, Eve Devon, Raine English, Tamara Ferguson, Lynda Haviland, Jody A. Kessler, Jane Lark, Bess McBride, L. L. Muir, Jennifer Gilby Roberts, Jan Romes, Heather Thurmeier, Elsa Winckler, Sarah Wynde
Ballads of Suburbia by Stephanie Kuehnert
The Truth about Us by Janet Gurtler
A Wish and a Prayer by Beverly Jenkins
Paying For It by Tony Black