Setting the JAXP context item
Many of the methods in the JAXP interface take an argument to represent the "context node". The concept of "context node" was generalized in XPath 2.0 to "context item", and any item may be supplied here. The supplied Java value is converted to an XDM value using the rules described at Converting Java values to XDM values. An error is reported if the resulting XDM value contains more than one item; if it is an empty sequence, then the XPath expression is evaluated with no context item.
The JAXP specification for many of these methods say that if the context node supplied is null, the XPath expression will be evaluated using an empty document node as the context node. Saxon does not implement this rule. There are two reasons for this. Firstly, it's unnatural in XPath 2.0, where it is permissible for the context item for an expression to be undefined. Secondly, it's not clear what kind of document node it would be appropriate to create, given that Saxon supports multiple object models. Instead, if null is supplied, the expression is evaluated with the context item undefined (which will cause a dynamic error if the expression actually refers to the context item).