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
trueorfalse. Be aware that thetrueorfalsestrings have no special meaning or value in XPath; see Section 4.2.1.2 in Chapter 4 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(orint) 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 Javafloatanddoubleprimitive types. In addition to ordinary numbers, there are five special values for numbers: positive and negative infinity, positive and negative zero, andNaN, 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.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access