Giter VIP home page Giter VIP logo

Comments (20)

oriol avatar oriol commented on May 27, 2024

The problem affects all contexts targeting an attribute.

It seems it is a bug in Schematron's official stylesheets.

https://stackoverflow.com/questions/40045725/when-using-xslt-2-schematron-ignores-rules-that-have-attributes-in-their-contex

The second solution described in the link above seems the best solution.

from einvoicing-en16931.

phax avatar phax commented on May 27, 2024

It is an official Schematron bug acknowledged in Schematron/schematron#29

from einvoicing-en16931.

SiwMeckelborg avatar SiwMeckelborg commented on May 27, 2024

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.

oriol avatar oriol commented on May 27, 2024

from einvoicing-en16931.

SiwMeckelborg avatar SiwMeckelborg commented on May 27, 2024

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.

oriol avatar oriol commented on May 27, 2024

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.

phax avatar phax commented on May 27, 2024

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.

SiwMeckelborg avatar SiwMeckelborg commented on May 27, 2024

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.

SiwMeckelborg avatar SiwMeckelborg commented on May 27, 2024

from einvoicing-en16931.

phax avatar phax commented on May 27, 2024

There are too many types that can contain an Amount currency (this is A to M):
grafik

from einvoicing-en16931.

SiwMeckelborg avatar SiwMeckelborg commented on May 27, 2024

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.

oriol avatar oriol commented on May 27, 2024

There are other rules that contain an attribute in the context. Not only currencyID...

from einvoicing-en16931.

SiwMeckelborg avatar SiwMeckelborg commented on May 27, 2024

There are 3 rules for EN16931, thats all

from einvoicing-en16931.

oriol avatar oriol commented on May 27, 2024
  <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.

SiwMeckelborg avatar SiwMeckelborg commented on May 27, 2024

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.

klakegg avatar klakegg commented on May 27, 2024

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.

phax avatar phax commented on May 27, 2024

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.

SiwMeckelborg avatar SiwMeckelborg commented on May 27, 2024

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.

phax avatar phax commented on May 27, 2024

Please go ahead and make a PR - we will than cross-check it. Does that sound reasonable?

from einvoicing-en16931.

klakegg avatar klakegg commented on May 27, 2024

PR provided - it's time to accept the update.

from einvoicing-en16931.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.