Chapter 11. XPath: Type Expressions
This chapter is concerned with XPath expressions that involve types. This includes operations to convert a value of one type to a value of another type (which is called casting), and operations to test whether a value belongs to a particular type.
The type system for XPath was fully explained in Chapter 5. Recall in particular that there are two separate but related sets of types we are concerned with:
Every value in XPath (that is, the result of every expression) is an instance of a sequence type. This reflects the fact that every XPath value is a sequence. A sequence type in general defines an item type that each of the items in the sequence must conform to, and a cardinality that constrains the number of items in the sequence. The items may be either nodes or atomic values, so item types divide into those that permit nodes and those that permit atomic values. There are also two special item types, the type
item()
, which permits anything, and the typeempty-sequence()
, which permits nothing.Every element and attribute node conforms to a type definition contained in a schema, or a built-in type definition that is implicit in every schema. To distinguish these clearly from sequence types, I will refer to these types as schema types. A schema type may be either a simple type or (for elements only) a complex type. A simple type may be either a list type, a union type, or an atomic type. A type definition constrains the contents of a node (that is, ...
Get XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.