Skip to content

Commit

Permalink
Moved a greek function to the function-section of the schematron file…
Browse files Browse the repository at this point in the history
… (before the first Pattern
  • Loading branch information
MartinForsberg-Ecru committed Sep 22, 2023
1 parent f428a69 commit ce15546
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
2 changes: 2 additions & 0 deletions guide/release-notes/v3.0.16.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ Release date:: 2023-11-01

* The validation rule identified as PEPPOL-EN16931-R006, which ensures that only one Invoice Object is allowed at the document level in an invoice/credit note, has been removed. This is because it duplicates the European standard rule UBL-SR-04, making it redundant and unnecessary.

* The structure of the Peppol Schematron rule set has been improved for better quality. A function that was previously located in the Greek rules section is now correctly positioned alongside other functions.

== Changes to Country-Specific Rules

36 changes: 19 additions & 17 deletions rules/sch/PEPPOL-EN16931-UBL.sch
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,24 @@ Last update: 2023 May release 3.0.15.
((string-to-codepoints(substring($val,11,1)) - 48) * 19)) mod 89 = 0
"/>
</function>

<!-- Functions and variable for Greek Rules -->
<function xmlns="http://www.w3.org/1999/XSL/Transform" name="u:TinVerification" as="xs:boolean">
<param name="val" as="xs:string"/>
<variable name="digits" select="
for $ch in string-to-codepoints($val)
return codepoints-to-string($ch)"/>
<variable name="checksum" select="
(number($digits[8])*2) +
(number($digits[7])*4) +
(number($digits[6])*8) +
(number($digits[5])*16) +
(number($digits[4])*32) +
(number($digits[3])*64) +
(number($digits[2])*128) +
(number($digits[1])*256) "/>
<value-of select="($checksum mod 11) mod 10 = number($digits[9])"/>
</function>
<!-- Empty elements -->
<pattern>
<rule context="//*[not(*) and not(normalize-space())]">
Expand Down Expand Up @@ -477,23 +495,7 @@ Last update: 2023 May release 3.0.15.
</rule>
</pattern>
<!-- GREECE -->
<!-- General functions and variable for Greek Rules -->
<function xmlns="http://www.w3.org/1999/XSL/Transform" name="u:TinVerification" as="xs:boolean">
<param name="val" as="xs:string"/>
<variable name="digits" select="
for $ch in string-to-codepoints($val)
return codepoints-to-string($ch)"/>
<variable name="checksum" select="
(number($digits[8])*2) +
(number($digits[7])*4) +
(number($digits[6])*8) +
(number($digits[5])*16) +
(number($digits[4])*32) +
(number($digits[3])*64) +
(number($digits[2])*128) +
(number($digits[1])*256) "/>
<value-of select="($checksum mod 11) mod 10 = number($digits[9])"/>
</function>
<!-- General variable for Greek Rules -->
<let name="isGreekSender" value="($supplierCountry ='GR') or ($supplierCountry ='EL')"/>
<let name="isGreekReceiver" value="($customerCountry ='GR') or ($customerCountry ='EL')"/>
<let name="isGreekSenderandReceiver" value="$isGreekSender and $isGreekReceiver"/>
Expand Down

0 comments on commit ce15546

Please sign in to comment.