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

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
10.43Mb size Format: txt, pdf, ePub
AtomicType
QName
KindTest
DocumentTest |
ElementTest |
AttributeTest |
PITest |
CommentTest |
TextTest |
AnyKindTest

The first rule tells us that a sequence type descriptor is either an
ItemType
followed optionally by an
OccurrenceIndicator
, or it is the compound symbol
empty-sequence()
.

The
empty-sequence()
construct is used very rarely in practice. The only value that conforms to this type is the empty sequence. This is why no occurrence indicator is allowed in this case. The only practical example I have seen where
empty-sequence()
is useful is in an XQuery
typeswitch
expression. You can use it in XPath, but
$x
instance
of
empty-sequence()
means the same as
empty($x)
, so it's not a vital feature. It's really there only for completeness, so that every type used in expressing the formal semantics of the language is also accessible to users of the language.

Apart from
empty-sequence()
, every other sequence type descriptor consists of an
ItemType
followed optionally by an
OccurrenceIndicator
. The
ItemType
defines what kind of items can appear in a sequence, and the
OccurrenceIndicator
says how many of them are allowed. The three occurrence indicators (which in computer science theory are often called Kleene operators) will be familiar from their use in regular expressions and DTDs. They are:

Other books

Chronic City by Jonathan Lethem
Shanghaied to the Moon by Michael J. Daley
Oh Say Can You Fudge by Nancy Coco
Truth or Dare by Tania Carver
Three Major Plays by Lope de Vega, Gwynne Edwards
Earth's Hope by Ann Gimpel
Cradle of Solitude by Alex Archer