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

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

The Blue Marble Gambit by Boson, Jupiter
420 by Kenya Wright, Jackie Sheats
Finding Faerie by Laura Lee
The Otto Bin Empire by Judy Nunn
Dolphins! by Sharon Bokoske
The Road To Jerusalem by Guillou, Jan
Stirred by J.A. Konrath, Blake Crouch
The Journey Home by Brandon Wallace
Trick or Treatment by Simon Singh, Edzard Ernst M.D.