There could be several reasons why an Xpath that works with $x does not work with document.evaluate:
Namespace differences: If the Xpath contains namespaces, it may not work with document.evaluate unless the namespaces are explicitly declared. $x may automatically resolve namespaces, while document.evaluate requires explicit namespace declarations.
Different default contexts: $x may use the current context as the default context when evaluating Xpaths, while document.evaluate may use a different context.
Syntax differences: $x may allow for certain syntax shortcuts or shorthand not supported by document.evaluate.
Implementation differences: The Xpath engine used by $x may be different than the one used by document.evaluate, leading to different behavior and results.
Unsupported Xpath features: $x may support certain Xpath features that are not supported by document.evaluate, leading to errors or incorrect results.
Asked: 2022-01-21 11:00:00 +0000
Seen: 13 times
Last updated: Sep 14 '21