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

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
6.37Mb size Format: txt, pdf, ePub

Most of these types were described fully in Chapter 5, but two are worth a special mention.

  • xs:untypedAtomic
    is the type of the atomic value that results from atomizing a node that has not been annotated (as a result of schema validation) with any more specific type. It is possible to create an
    xs:untypedAtomic
    value by casting (and it is sometimes convenient to do so), but the most common way of getting these values is by atomizing an unvalidated node.
  • xs:anyAtomicType
    is a supertype for all atomic types. Used as an item type, this will match any atomic value (for example, a string, an integer, or a boolean), and will not match a node. It's an abstract type, so something that is an instance of
    xs:anyAtomicType
    will always be an instance of some other more specific type in addition. (The name is rather poorly chosen, I feel. One might expect the instances of this type to be types, just as in Java the instances of
    Class
    are classes. But the name follows the tradition set by
    xs:anyType
    and
    xs:anySimpleType
    .)

Note that the
QName
must be the name of an atomic type, not merely a simple type. Simple types, in the XML schema classification, also include list types and union types. Atomic values contained in an XPath sequence always belong to an atomic type, not a list or union type, and a sequence type descriptor is therefore constrained to use atomic types. This rules out types such as
xs:NMTOKENS
,
xs:IDREFS
, and
xs:ENTITIES
, which are list types, as well as
xs:anyType
, which is a complex type.

Matching Nodes

All other sorts of
ItemType
are used to match nodes. These all come under the umbrella of the
KindTest
construct.

I'll dispose of the simple kinds of node first, and then move on to elements and attributes, which is where the real complexity comes.

Expression
Syntax
KindTest
AnyKindTest | DocumentTest | ElementTest | AttributeTest | CommentTest | TextTest | PITest
AnyKindTest
node
(
)
DocumentTest
document-node
(
ElementTest?
)
CommentTest
comment
(
)

Other books

Nosferatu the Vampyre by Paul Monette
Double Cross by James David Jordan
Fiddlers by Ed McBain
The Sacrificial Lamb by Fiore, Elle
The Templars by Michael Haag
A Man Called Sunday by Charles G. West
The Whitsun Weddings by Philip Larkin