Data Types

XPath's data model (XDM) defines a type hierarchy for every value a path expression can produce. The tree below lists all available data types, with subtypes indented under their parent type.

A normalizedString is a string that does not contain line feeds, carriage returns, or tabs.

A token is a string that does not contain line feeds, carriage returns, tabs, leading or trailing spaces, or multiple consecutive spaces.

XPath 3.1 defines several further string subtypes beyond those listed above.

A value can be cast to a type using the type's constructor function, e.g. xs:numeric(true()) returns 1.

Date and Time Examples

CategoryExamples
date2015-03-04
2015-03-04Z (UTC time)
2015-03-04+08:00
time13:30:10
13:30:10.6
12:00:00Z (UTC time)
12:00:00+08:00
datetime2015-03-04T12:00:00
2015-03-04T12:00:00Z (UTC time)
2015-03-04T12:00:00+08:00
durationP5Y3M9DT15H30M30S
P3M (3 months)
PT3M (3 minutes)
-P3D

xs:numeric(true())

1