despite XPath API spec states:
If a null value is provided for item, an empty document will be used for the context
saxon, starting from 9.6, they decided to ignore it and throw NPE if the node is null, from saxon javadoc:
Contrary to the interface specification, Saxon does not supply an empty document when the value is null. This is because XPath 2.0 allows the context item to be "absent" (null). So Saxon executes the XPath expression with the context item undefined.
So in case of xpath expression is executed against a null body or header, saxon throws an NPE