-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V8 #165
Conversation
phax
commented
Feb 15, 2024
•
edited
Loading
edited
- Fixes the variable resolution issue in pure mode by @bertrand-lorentz fixing Rule not being applied with PH-Schematron 5.2.0 #88 and Unable to compare attribute with variable (let) #143
- Update to Saxon 12.4
- Additional API cleansing only possible for major releases :)
Make the evaluation of variables declared in <let> more consistent with the Schematron ISO spec and other implementation. During bind(), store the variables as members of the bound item they are defined in: schema, pattern and rule. The variables declared in a phase are stored in the schema, as it is already bound to the phase. Each set of variables is stored as map of name to compiled XPath expression. During validate(), for each item we evaluate the corresponding variables in the appropriate context, and store the result in a LetVariableResolver instance. This instance is set as the XPathVariableResolver, so a variable value will be resolved when executing an XPath that references the variable. This fixes issue #143, so enable the corresponding unit test. This also resolves issue #88, so fix the corresponding unit test, as it was checking for the current behaviour, which is not correct.
Improve variable handling in pure mode
Make the evaluation of variables declared in <let> more consistent with the Schematron ISO spec and other implementation. During bind(), store the variables as members of the bound item they are defined in: schema, pattern and rule. The variables declared in a phase are stored in the schema, as it is already bound to the phase. Each set of variables is stored as map of name to compiled XPath expression. During validate(), for each item we evaluate the corresponding variables in the appropriate context, and store the result in a LetVariableResolver instance. This instance is set as the XPathVariableResolver, so a variable value will be resolved when executing an XPath that references the variable. This fixes issue #143, so enable the corresponding unit test. This also resolves issue #88, so fix the corresponding unit test, as it was checking for the current behaviour, which is not correct.
@bertrand-lorentz I did some further changes and cleansing - all the tests are still passing so I am confident that it is okay. The most relevant change was to use the "LetVariableResolver" only inside the bound Schematron to make sure it is always there. This simplifies the code and avoid dealing with the issue of it not being present. If you don't have any objections, I would merge this to main and start a release build. |
The change on the resolver looks good. Thanks for cleaning up ! 😄 I did notice an exception while running the unit test (although the test is not considered as failure):
I think it's because in PSXPathBoundSchema._evaluateVariables I had put Note: you don't need to rush out a release for my account. It will anyways take a while before we can make use of it in our application. |
Version bump
I changed the order to
|