Simplified handling of special case where document is the result of XPath expression.