Closed ojundt closed 5 years ago
Heh, nice catch. I will deflect blame upstream where I got the CEN rules from :) (and will report, but let's first see if we can fix it).
I think it is not so much the test itself, but the context that is wrong.
From the looks of it, this rule is only meant to be fired from within /cac:[Invoice|CreditNote]/cac:TaxTotal, and not from the InvoiceLines and CreditNoteLines; not only do the relative paths point to the wrong level then, the TaxableAmount will also be the wrong one (and if all are corrected to use an absolute path, the test is performed multiple times for all the values unless the context is fixed).
I have created a branch with what I think fixes it (by fixing the context), fix in commit 26d5d6a3b773f5ffec763a78ac4934e731998761
And I have created two test documents that shows the problem: https://github.com/SimplerInvoicing/testset/blob/master/SI-UBL-2.0/SI-UBL-2.0_BR-S-08_error.xml (should give error)
https://github.com/SimplerInvoicing/testset/blob/master/SI-UBL-2.0/SI-UBL-2.0_UBL-CR-561_warning.xml (should only warn, but errors as well due to this issue)
Thanks for the quick fix. I can confirm that the update XSL works.
Is it possible that this fix is being undone with commit https://github.com/SimplerInvoicing/validation/commit/e85addeb30bdffeafda101aa70df0c5cc5c17c61#diff-6dd04cdf48683997bf2d75f64a10c097?
We have updated the xsl file, and seem to be getting this error again.
Is it possible to release version 2.0.2 with this fix included?
I just came across a small bug in the XSL file for SI UBL 2.0 RC1.
Rule
BR-S-08
runs the following XPath query as test:in the context of
/xmlns:Invoice/cac:InvoiceLine/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory
.The path traversal in the
sum
parts does not go high enough. For example the linesum(../../../cac:InvoiceLine[ ...
is translated tosum(/xmlns:Invoice/cac:InvoiceLine/cac:InvoiceLine[ ...
which ofcourse does not give the expected results, causing the rule to always fail.