XPATH is a query-language specifically designed to retrieve results from an XML document hierarchy. As such the value of the result can be one of a finite set of data types where the data type is defined by the values it can take as well as the operations / functions which can be performed on it.
By design XPATH defines a method to compute a string-value for a queried node (element, attribute or text). A node is queried using an XPATH expression (as described on this site) which evaluates to an object where the object conforms to a simple set of of primitive types, as well as a more complex pointer types specifically related to XML. The available data types are:
|Boolean||A Boolean value (true or false, 1 or 0)|
|Number||Defines a floating point number.|
|String||a sequence of UCS characters|
|Node||A pointer to a node existing in the document.|
|Node-Set||An unordered collection of node-pointers without duplicates|
As mentioned previously: the object value can be one of a finite set of data types where the data type is defined by the values it can take as well as the operations / functions which can be performed on it. This means that the object data type is determined with respect to a context. The context is determined from where the XPATH expression is called (XSLT, XPointer, or others) on how it is used. Typically the context consists of:
|Node||A simple expression will return a node or node set from an XML document.|
|Variable Bindings||Variable bindings as defined in XSLT. A variable binding is defined by either a literal or an XPATH expression and / or function.|
|Functions||XPATH ships with a known library of functions. The function return determines the data type.|
|Namespace Declarations||Namespace declarations within the scope of the expression. Refer to the XML and XSLT tutorials for description on how namespaces relates to either the original XML document or an XSL document.|
A note on XML: XML defines no data types. By design all element, attribute and text nodes define strings/text – i.e. String.