-
Notifications
You must be signed in to change notification settings - Fork 12
Problem with SI-UBL 1.2 validation rules - attribute context #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
Comments
The suggested fix in and of itself isn't good, as the rules would then match any element that has a currencyID, and not the currencyID attribute node itself (thereby potentially exluding those nodes from later checks). And I may be wrong of course, but isn't this really a bug in the validation engine? An attribute is a node, and is selectable by an xpath expression such as those in context attributes. I don't have the latest version of the schematron specification readily available now that it got ISO-paywalled, but AFAIK it did not put any limitations on the types of selectable nodes in the context expression. |
@tjeb thanks for the swift response. I had created copies of the previous spec versions - you can find them at https://github.com/phax/ph-schematron/tree/master/docs The interesting link in the source issue points to Stack Overflow:
This points to the XSLT 2.0 spec: https://www.w3.org/TR/xslt20/#built-in-rule
Reading on, what "xsl:apply-templates with no select attribute" means: https://www.w3.org/TR/xslt20/#element-apply-templates
And finally the "node()" function is described at https://www.w3.org/TR/xslt20/#pattern-examples
Hence, the default XSLT template processing does not include attribute nodes. I agree, that my proposed resolution is eventually not ideal - but the general problem remains the same. Maybe you can place the assertion in an all the places where you need them, but using an attribute as a selector is not a general purpose solution imho. |
Luckily we have a few months until the next release cycle... there's other attributes that are used as selectors as well But does this mean the Schematron (2016) specification is unimplementable, or is this only a limitation of some implementation choices? Annex H point 2 clearly states a rule context rules may be attributes. |
Sorry I found no time yet, to properly respond to this, but I want to. My assumption is, that this is exactly the "magic" in the boilerplate code, the XSLT implementations create.... |
See issue #37 for the initial discussion. I think the issue as it was reported is really a bug in those validator implementations, but the original implementation did have another problem; it gave errors on any currencyID attribute that did not match the document-level currencyID. Some of this was hidden by a different rule matching first, but it could happen with extensions that have a currencyID value too. In order to both work around the validators that can't handle attribute-selection in rule context, and solve that issue, we have now specifically stated for which nodes the currency should be checked. However, the original code had other issues
and suddenly the next release is not far away at all anymore. I think I have a solution for this (and the related issue that the currency check was too wide-sweeping anyway), pushed in the branch above. One note though; there are other places where an attribute is used in the context selector (some of them in code we originally got from the peppol bis v2 group), going over all of them and finding potential overlapping context matches may be too much work for 1.2. It's not phased out yet, but it will be made optional for receivers soon, so it should then only be in use by parties that were already (successfully) using it and have not been able to move to 2.0 or PB3 yet. |
Hi all,
@ThijsFTW identified a gap in validation of the SI 1.2 rules, depending on the validation engine used.
All of this is reported at phax/phive-rules#9
The main explanation is in this sub-post: phax/phive-rules#9 (comment)
It would be great, if you could fix this in the old SI rules, and check that the SI-2.0 rules don't have similar issues.
Thanks :)
The text was updated successfully, but these errors were encountered: