update
This commit is contained in:
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Licensed under European Union Public Licence (EUPL) version 1.2.
|
||||
|
||||
-->
|
||||
<!--
|
||||
Abstract template
|
||||
|
||||
Timestamp: 2016-05-23 10:47:37 +0200
|
||||
|
||||
|
||||
The abstract file contains a pattern with and identifier and abstract = true.
|
||||
|
||||
The pattern contains the set of business rules as defined in the EN16931 in plain English.
|
||||
|
||||
Every rule has a context of use that is described using a variable that will have to be bound to each syntax XPATH expression (see syntax-binding-template.sch).
|
||||
For instance:
|
||||
$Account_information is the location within the XML instance where the Account information can be found.
|
||||
|
||||
Every rule has a collection of one or more assertions. Each assertion contains:
|
||||
A test: containing a variable that will point to the XPATH expression. The XPATH expression will be in the syntax-binding-template.sch file.
|
||||
A flag: describing whether it is an error ("fatal") or a notice ("warning").
|
||||
An identifier: of the assertion used for automation purposes.
|
||||
A message: with the explanation of the error.
|
||||
|
||||
-->
|
||||
|
||||
<pattern xmlns="http://purl.oclc.org/dsdl/schematron" abstract="true" id="TC434">
|
||||
<rule context="$Account_information ">
|
||||
<assert test="$BR-53" flag="fatal" id="BR-53">[BR-53]-A Financial account identifier shall be present if Account identification information is provided in the Invoice. </assert>
|
||||
</rule>
|
||||
<rule context="$Additional_supporting_documents ">
|
||||
<assert test="$BR-55" flag="fatal" id="BR-55">[BR-55]-Each additional supporting document shall contain a Supporting document identifier. </assert>
|
||||
<assert test="$BR-56" flag="fatal" id="BR-56">[BR-56]-Each additional supporting document shall contain a Supporting document description. </assert>
|
||||
</rule>
|
||||
<rule context="$Card_information ">
|
||||
<assert test="$BR-54" flag="fatal" id="BR-54">[BR-54]-The last 4 to 6 digit of the Payment card primary account number shall be present if card information is provided in the Invoice. </assert>
|
||||
</rule>
|
||||
<rule context="$Document_level_allowances ">
|
||||
<assert test="$BR-32" flag="fatal" id="BR-32">[BR-32]-Each document level allowance shall have a Document level allowance amount. </assert>
|
||||
<assert test="$BR-33" flag="fatal" id="BR-33">[BR-33]-Each document level allowance shall have a Document level allowance VAT category code. </assert>
|
||||
<assert test="$BR-35" flag="fatal" id="BR-35">[BR-35]-Each document level allowance shall have a Document level allowance reason. </assert>
|
||||
<assert test="$BR-36" flag="fatal" id="BR-36">[BR-36]-Document level allowance amounts shall not be negative. </assert>
|
||||
<assert test="$BR-CO-05" flag="fatal" id="BR-CO-05">[BR-CO-05]-Document level allowance reason code and Document level allowance reason shall indicate the same type of allowance. </assert>
|
||||
</rule>
|
||||
|
||||
<!-- ... -->
|
||||
|
||||
</pattern>
|
||||
|
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
|
||||
Licensed under European Union Public Licence (EUPL) version 1.2.
|
||||
|
||||
-->
|
||||
<!--
|
||||
Codes template
|
||||
|
||||
The code template file contains the rules specific to assess values for coded elements.
|
||||
|
||||
A timestamp is required in every file, created when generated. E.g.: 2016-05-23 10:47:49 +0200
|
||||
|
||||
This file should contain only a pattern with an identifier.
|
||||
|
||||
Every rule refers to a context where the actual XPATH where the rule applies is defined.
|
||||
|
||||
The rules contain asserts, where there is :
|
||||
A test, containing the XPATH expression to test for the allowed values in the code list.
|
||||
A flag: describing whether it is an error ("fatal") or a notice ("warning"). Fatal errors should stop the process of the invoice while warnings should not.
|
||||
An identifier: to allow for automatic processing.
|
||||
A message: with the proper explanation of the error.
|
||||
|
||||
-->
|
||||
|
||||
<pattern xmlns="http://purl.oclc.org/dsdl/schematron" id="CodesTC434">
|
||||
|
||||
<rule context="cbc:InvoiceTypeCode">
|
||||
<assert test="( ( not(contains(normalize-space(.),' ')) and contains( ' 380 393 384 381 ',concat(' ',normalize-space(.),' ') ) ) )"
|
||||
flag="fatal" id="BR-CL-01">[BR-CL-01]-An Invoice MUST be coded with the InvoiceTypeCode code list UNCL D1001 TC434 subset</assert>
|
||||
</rule>
|
||||
|
||||
<rule context="cac:AccountingSupplierParty/cac:Party//cac:Language//cbc:ID">
|
||||
<assert test="( ( not(contains(normalize-space(.),' ')) and contains( ' ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh cv kw co cr hr cs da dv nl dz en eo et ee fo fj fi fr ff gl ka de el gn gu ht ha he hz hi ho hu ia id ie ga ig ik io is it iu ja jv kl kn kr ks kk km ki rw ky kv kg ko ku kj la lb lg li ln lo lt lu lv gv mk mg ms ml mt mi mr mh mn na nv nb nd ne ng nn no ii nr oc oj cu om or os pa pi fa pl ps pt qu rm rn ro ru sa sc sd se sm sg sr gd sn si sk sl so st az es su sw ss sv ta te tg th ti bo tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa cy wo fy xh yi yo za zu ',concat(' ',normalize-space(.),' ') ) ) )"
|
||||
flag="warning" id="BR-CL-02">[BR-CL-02]-The lists of valid languages are registered with the ISO 639 Maintenance Agency Codes for the Representation of Names of Languages. It is recommended to use the ISO 639-1 alpha-2 representation</assert>
|
||||
</rule>
|
||||
|
||||
<rule context="@currencyID">
|
||||
<assert test="( ( not(contains(normalize-space(.),' ')) and contains( ' AED AFN ALL AMD ANG AOA ARS AUD AWG AZN BAM BBD BDT BGN BHD BIF BMD BND BOB BOV BRL BSD BTN BWP BYR BZD CAD CDF CHE CHF CHW CLF CLP CNY COP COU CRC CUP CVE CZK DJF DKK DOP DZD EEK EGP ERN ETB EUR FJD FKP GBP GEL GHS GIP GMD GNF GTQ GWP GYD HKD HNL HRK HTG HUF IDR ILS INR IQD IRR ISK JMD JOD JPY KES KGS KHR KMF KPW KRW KWD KYD KZT LAK LBP LKR LRD LSL LTL LVL LYD MAD MDL MGA MKD MMK MNT MOP MRO MUR MVR MWK MXN MXV MYR MZN NAD NGN NIO NOK NPR NZD OMR PAB PEN PGK PHP PKR PLN PYG QAR RON RSD RUB RWF SAR SBD SCR SDG SEK SGD SHP SKK SLL SOS SRD STD SVC SYP SZL THB TJS TMM TND TOP TRY TTD TWD TZS UAH UGX USD USN USS UYI UYU UZS VEF VND VUV WST XAF XAG XAU XBA XBB XBC XBD XCD XDR XFU XOF XPD XPF XTS XXX YER ZAR ZMK ZWR ZWD ',concat(' ',normalize-space(.),' ') ) ) )"
|
||||
flag="fatal" id="BR-CL-03">[BR-CL-03]-currencyID MUST be coded using ISO code list 4217 alpha-3</assert>
|
||||
</rule>
|
||||
|
||||
<rule context="cbc:DocumentCurrencyCode">
|
||||
<assert test="( ( not(contains(normalize-space(.),' ')) and contains( ' AED AFN ALL AMD ANG AOA ARS AUD AWG AZN BAM BBD BDT BGN BHD BIF BMD BND BOB BOV BRL BSD BTN BWP BYR BZD CAD CDF CHE CHF CHW CLF CLP CNY COP COU CRC CUP CVE CZK DJF DKK DOP DZD EEK EGP ERN ETB EUR FJD FKP GBP GEL GHS GIP GMD GNF GTQ GWP GYD HKD HNL HRK HTG HUF IDR ILS INR IQD IRR ISK JMD JOD JPY KES KGS KHR KMF KPW KRW KWD KYD KZT LAK LBP LKR LRD LSL LTL LVL LYD MAD MDL MGA MKD MMK MNT MOP MRO MUR MVR MWK MXN MXV MYR MZN NAD NGN NIO NOK NPR NZD OMR PAB PEN PGK PHP PKR PLN PYG QAR RON RSD RUB RWF SAR SBD SCR SDG SEK SGD SHP SKK SLL SOS SRD STD SVC SYP SZL THB TJS TMM TND TOP TRY TTD TWD TZS UAH UGX USD USN USS UYI UYU UZS VEF VND VUV WST XAF XAG XAU XBA XBB XBC XBD XCD XDR XFU XOF XPD XPF XTS XXX YER ZAR ZMK ZWR ZWD ',concat(' ',normalize-space(.),' ') ) ) )"
|
||||
flag="fatal" id="BR-CL-04">[BR-CL-04]-Invoice currency code MUST be coded using ISO code list 4217 alpha-3</assert>
|
||||
</rule>
|
||||
|
||||
<!--
|
||||
...
|
||||
-->
|
||||
</pattern>
|
@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Licensed under European Union Public Licence (EUPL) version 1.2.
|
||||
|
||||
-->
|
||||
<!--
|
||||
|
||||
Main schematron template
|
||||
|
||||
The main validation artefact contains the components used to validate a EN16931 electronic invoice instance for a particular language.
|
||||
|
||||
A timestamp is required in every file, created when generated. E.g.: 2016-05-23 10:47:49 +0200
|
||||
|
||||
Title should reflect the name of the norm and to what syntax it is valid for. E.g.: EN16931 business rules bound to OASIS UBL (ISO/IEC 19845)
|
||||
|
||||
This file should contain the namespace records required for the specific syntax. The namespace records have a prefix and a URI.
|
||||
|
||||
The main schametron can define validation phases to allow for groups of validation artefacts.
|
||||
It is suggested to have three different phases, one containing the EN16931 Business Rules, a second phase to cover the code business rules.
|
||||
|
||||
Each phase is defined through an identifier and has an active pattern where the identifier for the pattern shall be referred. (Patterns are created in separate files)
|
||||
|
||||
After the phases, the main schematron file shall contain includes of the files with the patterns. There shall be at least four files:
|
||||
1) The abstract rules file (see abstract-template.sch)
|
||||
2) The syntax binding rules file (see syntax-binding-template.sch)
|
||||
3) The code list rules file (see code-template.sch)
|
||||
|
||||
The main file is the one used for validation purposes.
|
||||
|
||||
-->
|
||||
<schema xmlns="http://purl.oclc.org/dsdl/schematron"
|
||||
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
|
||||
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
|
||||
xmlns:UBL="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
|
||||
queryBinding="xslt2">
|
||||
<title>EN16931 bound to UBL</title>
|
||||
<ns prefix="cbc" uri="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"/>
|
||||
<ns prefix="cac" uri="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"/>
|
||||
<ns prefix="ubl" uri="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"/>
|
||||
<phase id="BR_phase">
|
||||
<active pattern="{pattern id for the syntax binding file}"/>
|
||||
</phase>
|
||||
<phase id="CL_phase">
|
||||
<active pattern="{pattern id for the code file}"/>
|
||||
</phase>
|
||||
<!-- Abstract CEN BII patterns -->
|
||||
<!-- ========================= -->
|
||||
<include href="{path to the abstract file location}"/>
|
||||
<!-- Data Binding parameters -->
|
||||
<!-- ======================= -->
|
||||
<include href="{path to the syntax binding file location}"/>
|
||||
<!-- Code Lists Binding rules -->
|
||||
<!-- ======================== -->
|
||||
<include href="{path to the code list location}"/>
|
||||
</schema>
|
@ -0,0 +1,35 @@
|
||||
<!--
|
||||
|
||||
Licensed under European Union Public Licence (EUPL) version 1.2.
|
||||
|
||||
-->
|
||||
<!--
|
||||
Syntax binding template
|
||||
|
||||
A file containing the XPATH expressions for the test assertions
|
||||
|
||||
A timestamp is required in every file, created when generated. E.g.: 2016-05-23 10:47:49 +0200
|
||||
|
||||
This file contains a pattern that refers to:
|
||||
|
||||
is-a: refers to the identifier of the abstract rules file.
|
||||
id: contains the identifier for the pattern.
|
||||
|
||||
The pattern contains a set of params. Every variable defined in the abstract file shall have an assigned XPATH expression.
|
||||
The parameters for the param are:
|
||||
name: The identifier of the business rule as described in the abstract file
|
||||
value: The XPATH expression that makes this rule true.
|
||||
|
||||
-->
|
||||
|
||||
<pattern xmlns="http://purl.oclc.org/dsdl/schematron" is-a="TC434" id="UBL-TC434">
|
||||
<param name="BR-01" value="(cbc:CustomizationID)"/>
|
||||
<param name="BR-02" value="(cbc:ID)"/>
|
||||
<param name="BR-03" value="(cbc:IssueDate)"/>
|
||||
<param name="BR-04" value="(cbc:InvoiceTypeCode)"/>
|
||||
<param name="BR-05" value="(cbc:DocumentCurrencyCode)"/>
|
||||
<param name="BR-06" value="(cac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity/cbc:RegistrationName)"/>
|
||||
|
||||
<!-- ... -->
|
||||
|
||||
</pattern>
|
@ -0,0 +1 @@
|
||||
Licensed under European Union Public Licence (EUPL) version 1.2.
|
@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<!--
|
||||
|
||||
Licensed under European Union Public Licence (EUPL) version 1.2.
|
||||
|
||||
-->
|
||||
<!--Using xslt2 for transformation-->
|
||||
|
||||
<schema xmlns="http://purl.oclc.org/dsdl/schematron"
|
||||
xmlns:ns2="http://www.schematron-quickfix.com/validator/process" schemaVersion="iso"
|
||||
queryBinding="xslt2">
|
||||
|
||||
<!--
|
||||
|
||||
Title should reflect name of the norm, what kind of rules (codelists in separate file?), and to what syntax it is valid for.
|
||||
Example for syntax specific rules: "EN16931 Syntax rules CII Validation"
|
||||
Example for codelists: "EN16931 Code list rules ISO Validation"
|
||||
|
||||
-->
|
||||
|
||||
<title>EN16931 Business rules UBL Validation</title>
|
||||
<ns uri="urn:oasis:names:specification:ubl:schema:xsd:Tender-2" prefix="ubl"/>
|
||||
<ns uri="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" prefix="cbc"/>
|
||||
<ns uri="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" prefix="cac"/>
|
||||
<pattern>
|
||||
|
||||
<!--Example from eSens/EHF PreAward-->
|
||||
|
||||
<rule context="/ubl:Tender">
|
||||
<assert test="not(count(//*[not(node()[not(self::comment())])]) > 0)" flag="fatal"
|
||||
id="ESENS-T45-R001">A tender receipt notification MUST not contain empty
|
||||
elements.</assert>
|
||||
<assert test="(cbc:UBLVersionID)" flag="fatal" id="ESENS-T45-R003">A tender receipt
|
||||
notification MUST have a syntax identifier.</assert>
|
||||
</rule>
|
||||
|
||||
|
||||
<rule context="/ubl:Invoice">
|
||||
<!--
|
||||
|
||||
Using assert, not report to check validity.
|
||||
|
||||
@flag can have value either "fatal" or "warning" (if any)
|
||||
|
||||
@id to be set equal to corresponding business rule in norm draft
|
||||
- for syntax specific rules, suggest following legend for rule ids:
|
||||
Syntax-'SR'-sequence
|
||||
(SR=Syntax rule)
|
||||
|
||||
Example: UBL-SR-14
|
||||
EDIFACT-SR-12
|
||||
CII-SR-02
|
||||
ISO-SR-07
|
||||
Error text also identical to norm description of business rules, if new rules (/sytax specific) use wording "shall" and "shall not" to express rules.
|
||||
-->
|
||||
|
||||
<assert test="(cbc:ID)" flag="fatal" id="BR-2">An Invoice shall have an Invoice
|
||||
number</assert>
|
||||
</rule>
|
||||
|
||||
</pattern>
|
||||
</schema>
|
Reference in New Issue
Block a user