Comments (20)
The problem affects all contexts targeting an attribute.
It seems it is a bug in Schematron's official stylesheets.
The second solution described in the link above seems the best solution.
from einvoicing-en16931.
It is an official Schematron bug acknowledged in Schematron/schematron#29
from einvoicing-en16931.
I think these rules rather should be rewritten, to not have the attribute as the context. Either have the cbc:*[@Attribute], or possibly even better for performance issues, add the effected elements as context, like this:
<rule context="cbc:Amount | cbc:BaseAmount | cbc:PriceAmount >
All currencyID attributes must have the same value as the invoice currency code (BT-5), except for the invoice total VAT amount in accounting currency (BT-111)
from einvoicing-en16931.
from einvoicing-en16931.
Changed my comment, as the first variant was wrong, any /@Attribute will have the same problem. But as stated, I think the best solution is to name all elements, to prevent it from looping through all elements looking for the attribute.
from einvoicing-en16931.
The issue is on the stylesheets generating the XSLTs from the Schematron files, so I would not recommend changing the context but asking official Schematron to fix their bug.
from einvoicing-en16931.
Which will not happen quickly, because they don't have a test suite and afraid of side effects ;-) Maybe XSpec will be used to build up a test-suite in the future.... I would add this as a "known issue" and link to the fix. The official Schematron stylesheets are also not compatible with Saxon 9.8 because they are XSLT v1 and Saxon 9.8 only supports XSLT v2...
from einvoicing-en16931.
I think it is important to change our validation artefacts to avoid using a special schematron xslt. If implementers use the standard ISO artefacts, several rules will not fire, and invalid instance documents will be sent. My suggestion is to fix this in the TC434 artefacts, to ensure users can use the standard ISO schematron files.
from einvoicing-en16931.
from einvoicing-en16931.
There are too many types that can contain an Amount currency (this is A to M):
from einvoicing-en16931.
We do not use all these in the spec, so the check can be written as follows:
<rule context="cbc:Amount | cbc:BaseAmount | cbc:PriceAmount |
cac:TaxTotal[cac:TaxSubtotal]/cbc:TaxAmount | cbc:TaxableAmount |
cbc:LineExtensionAmount | cbc:TaxExclusiveAmount | cbc:TaxInclusiveAmount |
cbc:AllowanceTotalAmount | cbc:ChargeTotalAmount | cbc:PrepaidAmount |
cbc:PayableRoundingAmount | cbc:PayableAmount">
from einvoicing-en16931.
There are other rules that contain an attribute in the context. Not only currencyID...
from einvoicing-en16931.
There are 3 rules for EN16931, thats all
from einvoicing-en16931.
<rule context="@currencyID" flag="fatal">
<rule context="cac:AdditionalDocumentReference[cbc:DocumentTypeCode = '130']/cbc:ID/@schemeID | cac:DocumentReference[cbc:DocumentTypeCode = '130']/cbc:ID/@schemeID" flag="fatal">
<rule context="cac:PartyIdentification/cbc:ID/@schemeID" flag="fatal">
<rule context="cbc:CompanyID/@schemeID[not(ancestor::cac:PartyTaxScheme)]" flag="fatal">
<rule context="cac:CommodityClassification/cbc:ItemClassificationCode/@listID" flag="fatal">
<rule context="cac:StandardItemIdentification/cbc:ID/@schemeID" flag="fatal">
<rule context="@unitCode" flag="fatal">
<rule context="@mimeCode" flag="fatal">
from einvoicing-en16931.
My mistake.
I think the rules where it is not only the attribute, can easily be rewritten to use the predicate [@Attribute] , or move the attribute from the context to the test.
from einvoicing-en16931.
I don't see a change to Schematron being provided anytime soon, and after that you have a lot of tools that need to update something they've never updated before. Also I think the lack of support for addressing attributes in contexts is by design, because fixing the visiting part results in another problem related to the reported path of the assert.
I think it is more important to make sure the rules provided by TC434 works with what we have in Schematron today and not something we potentially may have in the future, and potentially even further into the future have updated tools.
from einvoicing-en16931.
This is a bug in the Schematron release and not in the Validation artefacts. So please force them to solve the issue - I don't see a problem at our side.
from einvoicing-en16931.
In my opinion, I don't think the discussion should be if this is a bug in Schematron or not. TC434 publishes validation artefacts that will be used by a large number of communities, and I find it very unfortunate to publish artefacts that need a special version of the Schematron stylesheets. The workaround for TC434 is quite simple, it is a small change in 8 of our rules, and then the ISO version can be used.
from einvoicing-en16931.
Please go ahead and make a PR - we will than cross-check it. Does that sound reasonable?
from einvoicing-en16931.
PR provided - it's time to accept the update.
from einvoicing-en16931.
Related Issues (20)
- The CII rules BG-20 and BG-21 seem to not be tested
- Typos in rule texts and xpath (UBL)
- README.md is not up to date HOT 2
- Include new publication adres for iso6523 HOT 2
- Redundant/broken rule in release v.1.3.9 HOT 5
- BR_IC_08 incorrect fail? HOT 9
- CII Validation artefact - rounding issue on BR-E-08 HOT 1
- CII - Xsd validation - Coupled schemas - ReasonCode - clm64465AllowanceChargeReasonCode:AllowanceChargeReasonCodeContentType HOT 2
- Typos in rule texts (CII)
- BR-51 check in UBL is bogus
- Codes
- CII - missing cardinality check for SpecifiedTradePaymentTerms HOT 1
- BR-17 rule checks too hard? HOT 4
- Typo in rule-text UBL-CR-583, UBL-CR-577 and UBL-CR-572 (UBL) HOT 1
- Typo in rule-text UBL-CR-282, UBL-CR-247 and UBL-CR-183 (UBL) HOT 1
- UBL-SR-51 does not check cac:DeliveryLocation HOT 1
- Error in Validation of Rule BR-E-08 HOT 1
- CII - missing cardinality check for ApplicableTradeTax (BG-30) HOT 1
- Validate line total HOT 1
- `UBL-SR-43` using attribute `scheme` instead of `schemeID` HOT 1
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 einvoicing-en16931.