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.61Mb 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 Selector of Souls by Shauna Singh Baldwin
Unquenchable Desire by Lynde Lakes
The Innocent Sleep by Karen Perry
All These Perfect Strangers by Aoife Clifford
Private Practice by Samanthe Beck
A Week of Mondays by Jessica Brody