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

The Woman in the Wall by Patrice Kindl
The Lunenburg Werewolf by Steve Vernon
The Surgeon's Blade by Mortimer, Faith
Angels Blood by Gerard Bond
If Wishes Were Earls by Elizabeth Boyle
The Marriage Bargain by Sandra Edwards
Golden Colorado by Katie Wyatt
The Shadow of the Soul by Sarah Pinborough