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

Raise the Titanic! by Clive Cussler
The January Wish by Juliet Madison
Deadly in High Heels by Gemma Halliday
Rev Girl by Leigh Hutton
The Pursuit of Laughter by Diana Mitford (Mosley)