XPath 2.0 implementation

The result of dividing two integers using the div operator is now a decimal, rather than a double. A consequence if this is that dividing by zero gives a run-time error, rather than Infinity. It may also affect the precision of results, but the effect is likely to be minor in most practical cases. (Actually, the computation is currently carried out with double precision, and then converted to a decimal, so the results are not as accurate as they could be.) This change exposed a bug in the handling of the mod operator for decimal arguments, which has been fixed.

A consequence of this change is that the avg() function when applied to a sequence of integers now returns an xs:decimal.

Numeric promotion is implemented in the type-checking rules: that is, an integer or decimal value can be supplied where a float or double is expected, and a float can be supplied where a double is expected. (The fact that this was not implemented before was something I had overlooked.)

The expression / (or a path expression starting with /) now returns an error if the context item is in a tree whose root is not a document node. The root() function, however, succeeds in this case. {seq018, seq908err, seq909err}

The constructs element(), element(*, T), attribute(), and attribute(*, T) are now allowed as NodeTests within a path expression. {type042, schema016-018}

In the processing-instruction() NodeTest, the quotes around the processing instruction name are now optional. The name must now be a valid NCName, whether or not it is enclosed in quotes. {copy63, node03}