Backwards Compatibility
Because of the changes in the data model and type system, not all expressions have exactly the same effect in XPath 2.0 as in 1.0. The main difference is that XPath 1.0 was more relaxed about type conversion, for example comparing two strings ("4" > "4.0"
) was quite possible but would do a numeric comparison; in XPath 2.0 this is defined to compare the two values as strings using a context-defined collating sequence.
To ease transition, XPath 2.0 defines a mode of execution in which the semantics are modified to be as close as possible to XPath 1.0 behavior. When using XSLT 2.0, this mode is activated by setting version="1.0"
as an attribute on the xsl:stylesheet
element. This still doesn't offer 100% compatibility, but any remaining differences are only likely to be encountered in unusual cases.
Read more about this topic: XPath 2.0