Fix XPath2Parser.parse() method

- In case of schema binding the static context evaluation uses
    the XPathToken.select() method because a context with a tree
    of nodes is provided.
This commit is contained in:
Davide Brunato 2019-08-05 11:37:59 +02:00
parent b5a0a87a3e
commit f00732ede5
1 changed files with 11 additions and 5 deletions

View File

@ -331,11 +331,17 @@ class XPath2Parser(XPath1Parser):
def parse(self, source):
root_token = super(XPath1Parser, self).parse(source)
context = None if self.schema is None else self.schema.get_context()
try:
root_token.evaluate(context) # Static context evaluation
except MissingContextError:
pass
if self.schema is None:
try:
root_token.evaluate() # Static context evaluation
except MissingContextError:
pass
else:
# Static context evaluation with a dynamic schema context
for _ in root_token.select(context=self.schema.get_context()):
pass
return root_token