Comments (5)
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.
from validation.
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.
from validation.
@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:
Source: https://stackoverflow.com/a/28305335/15254
The problem with your current approach is that the template matching the attribute/s is never applied. It isn't applied, because the built-in template rule matches only the root node and element nodes, and it applies templates only to children nodes. To apply a template to attributes, you must apply it explicitly yourself.
This points to the XSLT 2.0 spec: https://www.w3.org/TR/xslt20/#built-in-rule
When a node is selected by xsl:apply-templates and there is no template rule in the stylesheet that can be used to process that node, a built-in template rule is evaluated instead.
The built-in template rules apply to all modes.
The built-in rule for document nodes and element nodes is equivalent to calling xsl:apply-templates with no select attribute, and with the mode attribute set to #current. If the built-in rule was invoked with parameters, those parameters are passed on in the implicit xsl:apply-templates instruction.
Reading on, what "xsl:apply-templates with no select attribute" means: https://www.w3.org/TR/xslt20/#element-apply-templates
The default value of the
select
attribute ischild::node()
, which causes all the children of context node to be processed.
And finally the "node()" function is described at https://www.w3.org/TR/xslt20/#pattern-examples
node() matches any node other than an attribute node, namespace node, or document node.
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.
from validation.
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.
from validation.
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....
from validation.
Related Issues (20)
- PaymentMeansTypeCode HOT 4
- BR-*-05 BR-*-06 BR-*-07 BR-*-09 fail on negative zero HOT 3
- NLCIUS validations are not done when whitespaces are used in CustomizationID
- Code BR-GA-0 is not in error text in si-ubl-2.0-ext-gaccount.sch HOT 1
- Consider creating a check on //cac:PaymentMeans/cac:PayeeFinancialAccount/cbc:ID HOT 1
- Bug in BR-NL-10 test [SI-UBL-2.0-NLCIUS] HOT 2
- Bug in BR-NL-11 test [SI-UBL-2.0-NLCIUS] HOT 3
- Typo in comment [SI-UBL-2.0-NLCIUS]
- Check for [BR-NL-7] is not done with string HOT 2
- Wrong element checked for TypeCode of CreditNote
- Make 'contains' of CustomizationID in si-ubl-2.0-nlcius.sch HOT 5
- Why is NL:VAT (9944) not allowed in BR-NL-10? HOT 11
- cbc:PaymentMeansCode is checked against digit and not a string
- Minor errors in XSLT conversion bat script
- Let's just deprecate SI-1.2. It's the only Peppol BIS V2 based (Invoice) format left on the earth. HOT 4
- Question on November 2023 release HOT 2
- Suggestion: include preprocessed Schematron file
- Peppol BIS V3 NL-R-008 cross-border HOT 4
- PartyId validation like PEPPOL-COMMON-R041 for OINO and KVK
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from validation.