3.4. XPath Datatypes
An XPath expression returns one of four datatypes:
- node-set
-
Represents a set of nodes. The set can be empty, or it can contain any number of nodes.
- boolean
-
Represents the value true or false. Be aware that the true or false strings have no special meaning or value in XPath; see Section 4.2.1.2, "Boolean examples" in Chapter 4, "Branching and Control Elements" for a more detailed discussion of boolean values.
- number
-
Represents a floating-point number. All numbers in XPath and XSLT are implemented as floating-point numbers; the integer (or int) datatype does not exist in XPath and XSLT. Specifically, all numbers are implemented as IEEE 754 floating-point numbers, the same standard used by the Java float and double primitive types. In addition to ordinary numbers, there are five special values for numbers: positive and negative infinity, positive and negative zero, and NaN, the special symbol for anything that is not a number.
- string
-
Represents zero or more characters, as defined in the XML specification.
These datatypes are usually simple, and with the exception of node-sets, converting between types is usually straightforward. We won't discuss these datatypes in any more detail here; instead, we'll discuss datatypes and conversions as we need them to do specific tasks.
| | | 3.3. Attribute Value Templates | | 3.5. The XPath View of an XML Document |
Copyright © 2002 O'Reilly & Associates. All rights reserved.
|
|