{
  "engine": "v0.2.9",
  "sets": [
    {
      "key": "en16931",
      "name": "EN 16931",
      "note": "the core invoice model",
      "version": "EN 16931 Schematron 1.3.17 (updated 2026-10-09)",
      "syntaxes": {
        "cii": {
          "assertions": 810,
          "fatal": 339,
          "warning": 471,
          "information": 0,
          "ids": 810,
          "added": []
        },
        "ubl": {
          "assertions": 982,
          "fatal": 284,
          "warning": 698,
          "information": 0,
          "ids": 982,
          "added": []
        }
      }
    },
    {
      "key": "xrechnung",
      "name": "XRechnung",
      "note": "Germany’s mandate: a CIUS of EN 16931",
      "version": "2.6.0, for XRechnung 3.0.2",
      "syntaxes": {
        "cii": {
          "assertions": 862,
          "fatal": 379,
          "warning": 482,
          "information": 1,
          "ids": 862,
          "added": [
            {
              "id": "BR-DE-30",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-30] Wenn \"DIRECT DEBIT\" BG-19 vorhanden ist, dann muss \"Bank assigned creditor identifier\" BT-90 übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice",
              "test": "(($BT-89-path or $BT-91-path) and $BT-90-path) or $BG-19-not-existing",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-31",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-31] Wenn \"DIRECT DEBIT\" BG-19 vorhanden ist, dann muss \"Debited account identifier\" BT-91 übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice",
              "test": "(($BT-89-path or $BT-90-path) and $BT-91-path) or $BG-19-not-existing",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-1",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-1] Eine Rechnung (INVOICE) muss Angaben zu \"PAYMENT INSTRUCTIONS\" (BG-16) enthalten.",
              "context": "/rsm:CrossIndustryInvoice",
              "test": "rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-15",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-15] Das Element \"Buyer reference\" (BT-10) muss übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice",
              "test": "rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerReference[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-16",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-16] Wenn in einer Rechnung die Steuercodes S, Z, E, AE, K, G, L oder M verwendet werden, muss mindestens eines der Elemente \"Seller VAT identifier\" (BT-31), \"Seller tax registration identifier\" (BT-32)\n          oder \"SELLER TAX REPRESENTATIVE PARTY\" (BG-11) übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice",
              "test": "not((rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax/ram:TypeCode = 'VAT' and\n                         rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax/ram:CategoryCode = ('S', 'Z', 'E', 'AE', 'K', 'G', 'L', 'M')) or\n                        (rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge/ram:CategoryTradeTax = 'VAT' and\n                         rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge/ram:CategoryTradeTax/ram:CategoryCode = ('S', 'Z', 'E', 'AE', 'K', 'G', 'L', 'M')) or\n                        (rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax/ram:TypeCode = 'VAT' and\n                         rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax/ram:CategoryCode = ('S', 'Z', 'E', 'AE', 'K', 'G', 'L', 'M'))) or\n                    ((rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedTaxRegistration/ram:ID[normalize-space(@schemeID)='VA' or\n                                                                                                                                                  normalize-space(@schemeID)='FC'][boolean(normalize-space(.))], rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTaxRepresentativeTradeParty))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-17",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-DE-17] Mit dem Element \"Invoice type code\" (BT-3) sollen ausschließlich folgende Codes aus der Codeliste UNTDID 1001 übermittelt werden: 326 (Partial invoice), 380 (Commercial invoice), 384 (Corrected invoice), 389 (Self-billed invoice) und 381 (Credit note),875 (Partial construction invoice), 876 (Partial final construction invoice), 877 (Final construction invoice).",
              "context": "/rsm:CrossIndustryInvoice",
              "test": "normalize-space(rsm:ExchangedDocument/ram:TypeCode) = ('326', '380', '384', '389', '381', '875', '876', '877')",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-18",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-18] Skonto Zeilen in  muessen diesem regulärem Ausdruck entsprechen: . Die Informationen zur Gewährung von Skonto müssen wie folgt im Element \"Payment terms\" (BT-20) übermittelt werden: Anzugeben ist im ersten Segment \"SKONTO\", im zweiten \"TAGE=n\", im dritten \"PROZENT=n\". Prozentzahlen sind ohne Vorzeichen sowie mit Punkt getrennt von zwei Nachkommastellen anzugeben. Liegt dem zu berechnenden Betrag nicht BT-115, \"fälliger Betrag\" zugrunde, sondern nur ein Teil des fälligen Betrags der Rechnung, ist der Grundwert zur Berechnung von Skonto als viertes Segment \"BASISBETRAG=n\" gemäß dem semantischen Datentypen Amount anzugeben. Jeder Eintrag beginnt mit einer #, die Segmente sind mit einer # getrennt und eine Zeile schließt mit einer # ab. Am Ende einer vollständigen Skontoangabe muss ein XML-konformer Zeilenumbruch folgen. Alle Angaben zur Gewährung von Skonto müssen in Großbuchstaben gemacht werden. Zusätzliches Whitespace (Leerzeichen, Tabulatoren oder Zeilenumbrüche) ist nicht zulässig. Andere Zeichen oder Texte als in den oberen Vorgaben genannt sind nicht zulässig.",
              "context": "/rsm:CrossIndustryInvoice",
              "test": "every $line \n                      in rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradePaymentTerms/ram:Description[1]/tokenize(. , '(\\r?\\n)')[starts-with( normalize-space(.) , '#')] \n                      satisfies matches ( normalize-space ($line), $XR-SKONTO-REGEX ) and\n                    matches( rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradePaymentTerms/ram:Description[1]/tokenize(. ,  '#.+#')[last()], '^\\s*\\n' )",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-22",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-22] Not all filename attributes of the embeddedDocumentBinaryObject elements are unique",
              "context": "/rsm:CrossIndustryInvoice",
              "test": "count(//ram:AdditionalReferencedDocument) = count(//ram:AdditionalReferencedDocument[not(./ram:AttachmentBinaryObject/@filename = preceding-sibling::ram:AdditionalReferencedDocument/ram:AttachmentBinaryObject/@filename)])",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-26",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-DE-26] Wenn im Element Invoice type code (BT-3) der Code 384 (Corrected invoice) übergeben wird, soll PRECEDING INVOICE REFERENCE BG-3 mind. einmal vorhanden sein.",
              "context": "/rsm:CrossIndustryInvoice",
              "test": "not(normalize-space(rsm:ExchangedDocument/ram:TypeCode) = '384') or\n                    (rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:InvoiceReferencedDocument)",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-21",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-DE-21] Das Element \"Specification identifier\" (BT-24) soll syntaktisch der Kennung des Standards XRechnung entsprechen.",
              "context": "/rsm:CrossIndustryInvoice/rsm:ExchangedDocumentContext",
              "test": "ram:GuidelineSpecifiedDocumentContextParameter/ram:ID = $XR-CIUS-ID or\n                    ram:GuidelineSpecifiedDocumentContextParameter/ram:ID = $XR-EXTENSION-ID or\n                    ram:GuidelineSpecifiedDocumentContextParameter/ram:ID = $XR-CVD-ID",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-2",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-2] Die Gruppe \"SELLER CONTACT\" (BG-6) muss übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty",
              "test": "ram:DefinedTradeContact",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-3",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-3] Das Element \"Seller city\" (BT-37) muss übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:PostalTradeAddress",
              "test": "ram:CityName[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-4",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-4] Das Element \"Seller post code\" (BT-38) muss übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:PostalTradeAddress",
              "test": "ram:PostcodeCode[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-5",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-5] Das Element \"Seller contact point\" (BT-41) muss übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:DefinedTradeContact",
              "test": "(ram:PersonName,ram:DepartmentName)[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-6",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-6] Das Element \"Seller contact telephone number\" (BT-42) muss übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:DefinedTradeContact",
              "test": "ram:TelephoneUniversalCommunication/ram:CompleteNumber[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-7",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-7] Das Element \"Seller contact email address\" (BT-43) muss übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:DefinedTradeContact",
              "test": "ram:EmailURIUniversalCommunication/ram:URIID[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-27",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-DE-27] In BT-42 sollen mindestens drei Ziffern enthalten sein.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:DefinedTradeContact",
              "test": "matches(normalize-space(ram:TelephoneUniversalCommunication/ram:CompleteNumber), $XR-TELEPHONE-REGEX)",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-28",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-DE-28] In BT-43 soll genau ein @-Zeichen enthalten sein, welches nicht von einem Leerzeichen, einem Punkt, aber mindestens zwei Zeichen auf beiden Seiten flankiert werden soll. Ein Punkt sollte nicht am Anfang oder am Ende stehen.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:DefinedTradeContact",
              "test": "matches(normalize-space(ram:EmailURIUniversalCommunication/ram:URIID), $XR-EMAIL-REGEX)",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-8",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-8] Das Element \"Buyer city\" (BT-52) muss übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerTradeParty/ram:PostalTradeAddress",
              "test": "ram:CityName[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-9",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-9] Das Element \"Buyer post code\" (BT-53) muss übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerTradeParty/ram:PostalTradeAddress",
              "test": "ram:PostcodeCode[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-TMP-2",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-TMP-2] BT-124 \"External document location\" muss eine absolute URL mit gültigem Schema enthalten.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:AdditionalReferencedDocument[ram:TypeCode = '916']",
              "test": "not(exists(ram:URIID)) or (matches(ram:URIID, $XR-URL-REGEX))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-TMP-4",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-TMP-4] BT-123 \"Supporting document description\" (ram:Name) darf innerhalb von \"Additional supporting documents\" (BG-24) höchstens einmal vorkommen.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:AdditionalReferencedDocument[ram:TypeCode = '916']",
              "test": "count(ram:Name) <= 1",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-TMP-5",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-TMP-5] BT-125 \"Attached document\" (ram:AttachmentBinaryObject) darf innerhalb von \"Additional Supporting documents\" (BG-24) höchstens einmal vorkommen.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:AdditionalReferencedDocument[ram:TypeCode = '916']",
              "test": "count(ram:AttachmentBinaryObject) <= 1",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-TMP-7",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-TMP-7] Datumsangaben in UNCEFACT/CII müssen das Attribut format=\"102\" tragen und im Format JJJJMMTT (YYYYMMDD) übermittelt werden.",
              "context": "udt:DateTimeString | qdt:DateTimeString | udt:DateString",
              "test": "normalize-space(@format) = '102' and matches(normalize-space(text()), '^\\d{8}$')",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-10",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-10] Das Element \"Deliver to city\" (BT-77) muss übermittelt werden, wenn die Gruppe \"DELIVER TO ADDRESS\" (BG-15) übermittelt wird.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:ShipToTradeParty/ram:PostalTradeAddress",
              "test": "ram:CityName[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-11",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-11] Das Element \"Deliver to post code\" (BT-78) muss übermittelt werden, wenn die Gruppe \"DELIVER TO ADDRESS\" (BG-15) übermittelt wird.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:ShipToTradeParty/ram:PostalTradeAddress",
              "test": "ram:PostcodeCode[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-19",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-DE-19] \"Payment account identifier\" (BT-84) soll eine korrekte IBAN enthalten, wenn in \"Payment means type code\" (BT-81) mit dem Code 58 SEPA als Zahlungsmittel gefordert wird.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans[normalize-space(ram:TypeCode) = ('30','58')]",
              "test": "not(normalize-space(ram:TypeCode) = '58') or\n                    xr:checkIBAN(string(ram:PayeePartyCreditorFinancialAccount/ram:IBANID))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-23-a",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-23-a] Wenn BT-81 \"Payment means type code\" einen Schlüssel für Überweisungen enthält (30, 58), muss BG-17 \"CREDIT TRANSFER\" übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans[normalize-space(ram:TypeCode) = ('30','58')]",
              "test": "ram:PayeePartyCreditorFinancialAccount",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-23-b",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-23-b] Wenn BT-81 \"Payment means type code\" einen Schlüssel für Überweisungen enthält (30, 58), dürfen BG-18 und BG-19 nicht übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans[normalize-space(ram:TypeCode) = ('30','58')]",
              "test": "not(ram:ApplicableTradeSettlementFinancialCard) and\n                    not(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradePaymentTerms/ram:DirectDebitMandateID or\n                        /rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:CreditorReferenceID or\n                        ram:PayerPartyDebtorFinancialAccount/ram:IBANID)",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-24-a",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-24-a] Wenn BT-81 \"Payment means type code\" einen Schlüssel für Kartenzahlungen enthält (48, 54, 55), muss genau BG-18 \"PAYMENT CARD INFORMATION\" übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans[normalize-space(ram:TypeCode) = ('48','54','55')]",
              "test": "ram:ApplicableTradeSettlementFinancialCard",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-24-b",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-24-b] Wenn BT-81 \"Payment means type code\" einen Schlüssel für Kartenzahlungen enthält (48, 54, 55), dürfen BG-17 und BG-19 nicht übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans[normalize-space(ram:TypeCode) = ('48','54','55')]",
              "test": "not(ram:PayeePartyCreditorFinancialAccount) and\n                    not(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradePaymentTerms/ram:DirectDebitMandateID or\n                        /rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:CreditorReferenceID or\n                        ram:PayerPartyDebtorFinancialAccount/ram:IBANID)",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-20",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-DE-20] \"Debited account identifier\" (BT-91) soll eine korrekte IBAN enthalten, wenn in \"Payment means type code\" (BT-81) mit dem Code 59 SEPA als Zahlungsmittel gefordert wird.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans[normalize-space(ram:TypeCode) = '59']",
              "test": "not(normalize-space(ram:TypeCode) = '59') or\n                    xr:checkIBAN(string(ram:PayerPartyDebtorFinancialAccount/ram:IBANID))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-25-a",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-25-a] Wenn BT-81 \"Payment means type code\" einen Schlüssel für Lastschriften enthält (59), muss genau BG-19 \"DIRECT DEBIT\" übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans[normalize-space(ram:TypeCode) = '59']",
              "test": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradePaymentTerms/ram:DirectDebitMandateID or\n                    /rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:CreditorReferenceID or\n                    ram:PayerPartyDebtorFinancialAccount/ram:IBANID",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-25-b",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-25-b] Wenn BT-81 \"Payment means type code\" einen Schlüssel für Lastschriften enthält (59), dürfen BG-17 und BG-18 nicht übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans[normalize-space(ram:TypeCode) = '59']",
              "test": "not(ram:PayeePartyCreditorFinancialAccount) and\n                    not(ram:PayeeSpecifiedCreditorFinancialInstitution) and\n                    not(ram:PayerSpecifiedDebtorFinancialInstitution) and\n                    not(ram:ApplicableTradeSettlementFinancialCard)",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-14",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-14] Das Element \"VAT category rate\" (BT-119) muss übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax",
              "test": "ram:RateApplicablePercent[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-TMP-32",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "information",
              "text": "[BR-DE-TMP-32] Eine Rechnung sollte zur Angabe des Liefer-/Leistungsdatums entweder BT-72 \"Actual delivery date\", BG-14 \"Invoicing period\" oder in jeder Rechnungsposition BG-26 \"Invoice line period\" enthalten.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction",
              "test": "\n              ram:ApplicableHeaderTradeDelivery/ram:ActualDeliverySupplyChainEvent/ram:OccurrenceDateTime\n              or ram:ApplicableHeaderTradeSettlement/ram:BillingSpecifiedPeriod\n              or (every $line in ram:IncludedSupplyChainTradeLineItem\n              satisfies $line/ram:SpecifiedLineTradeSettlement/ram:BillingSpecifiedPeriod)",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-TMP-3",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-TMP-3] Wenn BT-149 (Item price base quantity) sowohl in GrossPriceProductTradePrice als auch in NetPriceProductTradePrice vorhanden ist, müssen die Werte identisch sein. Wenn BT-150 (unit of measure code) auf dem NetPrice-Pfad vorhanden ist, muss es auch auf dem GrossPrice-Pfad vorhanden und identisch sein.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem",
              "test": "not(ram:SpecifiedLineTradeAgreement/ram:GrossPriceProductTradePrice/ram:BasisQuantity\n                        and\n                        ram:SpecifiedLineTradeAgreement/ram:NetPriceProductTradePrice/ram:BasisQuantity)\n                    or\n                    (ram:SpecifiedLineTradeAgreement/ram:GrossPriceProductTradePrice/ram:BasisQuantity =\n                     ram:SpecifiedLineTradeAgreement/ram:NetPriceProductTradePrice/ram:BasisQuantity\n                     and\n                     (not(ram:SpecifiedLineTradeAgreement/ram:NetPriceProductTradePrice/ram:BasisQuantity/@unitCode\n                     and\n                     ram:SpecifiedLineTradeAgreement/ram:GrossPriceProductTradePrice/ram:BasisQuantity/@unitCode)\n                      or\n                      ram:SpecifiedLineTradeAgreement/ram:GrossPriceProductTradePrice/ram:BasisQuantity/@unitCode =\n                      ram:SpecifiedLineTradeAgreement/ram:NetPriceProductTradePrice/ram:BasisQuantity/@unitCode))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-15",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-DEX-15] This CII file might use the concept of Sub Invoice Lines. However XRechnung does not support this.",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:AssociatedDocumentLineDocument[$isExtension]",
              "test": "not(exists(//ram:ParentLineID))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-04",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DEX-04] Any scheme identifier in  MUST be coded using one of the ISO 6523 ICD list.",
              "context": "//ram:GlobalID[@schemeID and $isExtension][not(ancestor::ram:SpecifiedTradeProduct) and not(ancestor::ram:ShipToTradeParty)]",
              "test": "((not(contains(normalize-space(@schemeID), ' ')) and contains($ISO-6523-ICD-EXT-CODES, concat(' ', normalize-space(@schemeID), ' '))))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-05",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DEX-05] Any scheme identifier in  MUST be coded using one of the ISO 6523 ICD list.",
              "context": "ram:ID[@schemeID and $isExtension][not(ancestor::ram:SpecifiedTaxRegistration)]",
              "test": "((not(contains(normalize-space(@schemeID), ' ')) and contains($ISO-6523-ICD-EXT-CODES, concat(' ', normalize-space(@schemeID), ' '))))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-06",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DEX-06] Any scheme identifier in  MUST be coded using one of the ISO 6523 ICD list.",
              "context": "ram:SpecifiedTradeProduct/ram:GlobalID[@schemeID and $isExtension]",
              "test": "((not(contains(normalize-space(@schemeID), ' ')) and contains($ISO-6523-ICD-EXT-CODES, concat(' ', normalize-space(@schemeID), ' '))))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-07",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DEX-07] Any scheme identifier for an Endpoint Identifier in  MUST belong to the CEF EAS code list.",
              "context": "ram:URIUniversalCommunication/ram:URIID[@schemeID and $isExtension]",
              "test": "((not(contains(normalize-space(@schemeID), ' ')) and contains($CEF-EAS-EXT-CODES, concat(' ', normalize-space(@schemeID), ' '))))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-08",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DEX-08] Any scheme identifier for a Delivery location identifier in  MUST be coded using one of the ISO 6523 ICD list.",
              "context": "ram:ApplicableHeaderTradeDelivery/ram:ShipToTradeParty/ram:GlobalID[@schemeID and $isExtension]",
              "test": "((not(contains(normalize-space(@schemeID), ' ')) and contains($ISO-6523-ICD-EXT-CODES, concat(' ', normalize-space(@schemeID), ' '))))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-01",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DEX-01] Das Element  \"Attached Document\" (BT-125) benutzt einen nicht zulässigen MIME-Code: . Im Falle einer Extension darf zusätzlich zu der Liste der mime codes (definiert in Abschnitt 8.2, \"Binary Object\") der MIME-Code application/xml genutzt werden.",
              "context": "ram:AttachmentBinaryObject[$isExtension]",
              "test": ".[@mimeCode = 'application/pdf' or\n              @mimeCode = 'image/png' or\n              @mimeCode = 'image/jpeg' or\n              @mimeCode = 'text/csv' or\n              @mimeCode = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' or\n              @mimeCode = 'application/vnd.oasis.opendocument.spreadsheet' or\n              @mimeCode = 'application/xml']",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-CVD-03",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-CVD-03] In einer Rechnung muss mindestens eine  INVOICE LINE (BG-25) enthalten sein, in der der Scheme identifier von  \"Item classification identifier\" (BT-158) den Wert 'CVD' und der  \"Item attribute name\" (BT-160) den Wert 'cva' enthält.",
              "context": "/rsm:CrossIndustryInvoice[$isCVD]/rsm:SupplyChainTradeTransaction",
              "test": "ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedTradeProduct[ram:DesignatedProductClassification/ram:ClassCode/@listID = 'CVD' and ram:ApplicableProductCharacteristic/ram:Description = 'cva']",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-CVD-06-b",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-CVD-06-b] Wenn  \"Item attribute name\" (BT-160) mit dem Wert 'cva' angegeben ist, muss in derselben Rechnungszeile genau ein  \"Item classification identifier\" (BT-158) mit dem Scheme identifier 'CVD' vorhanden sein.",
              "context": "/rsm:CrossIndustryInvoice[$isCVD]/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedTradeProduct",
              "test": "not(ram:ApplicableProductCharacteristic/ram:Description = 'cva') or count(ram:DesignatedProductClassification/ram:ClassCode[@listID = 'CVD']) = 1",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-CVD-06-a",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-CVD-06-a] Wenn der Scheme identifier von  \"Item classification identifier\" (BT-158) mit dem Wert 'CVD' angegeben ist, muss in derselben Rechnungszeile genau ein  \"Item attribute name\" (BT-160) mit dem Wert 'cva' vorhanden sein.",
              "context": "/rsm:CrossIndustryInvoice[$isCVD]/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedTradeProduct",
              "test": "not(ram:DesignatedProductClassification/ram:ClassCode/@listID = 'CVD') or count(ram:ApplicableProductCharacteristic[ram:Description = 'cva']) = 1",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-TMP-CVD-01",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-TMP-CVD-01] Das Bildungsschema für  \"Item classification identifier\" (BT-158) ist aus der Codeliste UNTDID 7143 zu wählen.",
              "context": "/rsm:CrossIndustryInvoice[$isCVD]/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedTradeProduct/ram:DesignatedProductClassification/ram:ClassCode",
              "test": "((not(contains(normalize-space(@listID), ' ')) and contains($UNTDID-7143-CVD-CODES, concat(' ', normalize-space(@listID), ' '))))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-CVD-04",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-CVD-04] Ein  \"Item classification identifier\" (BT-158) mit dem Scheme identifier 'CVD' muss einen Wert aus der Liste der zulässigen Fahrzeugkategorien enthalten.",
              "context": "/rsm:CrossIndustryInvoice[$isCVD]/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedTradeProduct/ram:DesignatedProductClassification/ram:ClassCode",
              "test": "not(normalize-space(@listID) = 'CVD') or normalize-space(.) = $CVD-VEHICLE-CATEGORY",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-CVD-05",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-CVD-05] Wenn innerhalb von  ITEM ATTRIBUTES (BG-32) der  \"Item attribute name\" (BT-160) den Wert 'cva' hat, muss der  \"Item attribute value\" (BT-161) einen der zulässigen Werte enthalten.",
              "context": "/rsm:CrossIndustryInvoice[$isCVD]/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedTradeProduct/ram:ApplicableProductCharacteristic[ram:Description = 'cva']",
              "test": "normalize-space(ram:Value) = $CVA-CODES",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-CVD-01",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-CVD-01] Das Element  \"Contract reference\" (BT-12) muss übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice[$isCVD]/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement",
              "test": "ram:ContractReferencedDocument/ram:IssuerAssignedID[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-CVD-02",
              "syntax": "CII",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-CVD-02] Das Element  \"Tender or lot reference\" (BT-17) muss übermittelt werden.",
              "context": "/rsm:CrossIndustryInvoice[$isCVD]/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement",
              "test": "ram:AdditionalReferencedDocument[normalize-space(ram:TypeCode) = '50' and normalize-space(ram:IssuerAssignedID)]",
              "phases": [
                "xrechnung-model"
              ]
            }
          ]
        },
        "ubl": {
          "assertions": 1038,
          "fatal": 330,
          "warning": 707,
          "information": 1,
          "ids": 1038,
          "added": [
            {
              "id": "BR-DE-1",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-1] Eine Rechnung (INVOICE) muss Angaben zu \"PAYMENT INSTRUCTIONS\" (BG-16) enthalten.",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "cac:PaymentMeans",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-15",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-15] Das Element \"Buyer reference\" (BT-10) muss übermittelt werden.",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "cbc:BuyerReference[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-16",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-16] Wenn in einer Rechnung die Steuercodes S, Z, E, AE, K, G, L oder M verwendet werden, muss mindestens eines der Elemente \"Seller VAT identifier\" (BT-31), \"Seller tax registration identifier\" (BT-32)\n        oder \"SELLER TAX REPRESENTATIVE PARTY\" (BG-11) übermittelt werden.",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "\n        (not(\n          ($BT-95-UBL-Inv = $supportedVATCodes or $BT-95-UBL-CN = $supportedVATCodes) or\n          ($BT-102 = $supportedVATCodes) or\n          ($BT-151 = $supportedVATCodes)\n        ) or\n        (cac:TaxRepresentativeParty, $BT-31orBT-32Path))\n        ",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-17",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-DE-17] Mit dem Element \"Invoice type code\" (BT-3) sollen ausschließlich folgende Codes aus der Codeliste UNTDID 1001 übermittelt werden: 326 (Partial invoice), 380 (Commercial invoice), 384 (Corrected invoice), 389 (Self-billed invoice) und 381 (Credit note),875 (Partial construction invoice), 876 (Partial final construction invoice), 877 (Final construction invoice).",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "normalize-space(cbc:InvoiceTypeCode) = $supportedInvAndCNTypeCodes\n        or normalize-space(cbc:CreditNoteTypeCode) = $supportedInvAndCNTypeCodes",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-18",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-18] Skonto Zeilen in  müssen diesem regulärem Ausdruck entsprechen: . Die Informationen zur Gewährung von Skonto müssen wie folgt im Element \"Payment terms\" (BT-20) übermittelt werden: Anzugeben ist im ersten Segment \"SKONTO\", im zweiten \"TAGE=n\", im dritten \"PROZENT=n\". Prozentzahlen sind ohne Vorzeichen sowie mit Punkt getrennt von zwei Nachkommastellen anzugeben. Liegt dem zu berechnenden Betrag nicht BT-115, \"fälliger Betrag\" zugrunde, sondern nur ein Teil des fälligen Betrags der Rechnung, ist der Grundwert zur Berechnung von Skonto als viertes Segment \"BASISBETRAG=n\" gemäß dem semantischen Datentypen Amount anzugeben. Jeder Eintrag beginnt mit einer #, die Segmente sind mit einer # getrennt und eine Zeile schließt mit einer # ab. Am Ende einer vollständigen Skontoangabe muss ein XML-konformer Zeilenumbruch folgen. Alle Angaben zur Gewährung von Skonto müssen in Großbuchstaben gemacht werden. Zusätzliches Whitespace (Leerzeichen, Tabulatoren oder Zeilenumbrüche) ist nicht zulässig. Andere Zeichen oder Texte als in den oberen Vorgaben genannt sind nicht zulässig.",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "every $line in\n            cac:PaymentTerms/cbc:Note[1]/tokenize(. , '(\\r?\\n)')[starts-with( normalize-space(.) , '#')] \n            satisfies matches ( normalize-space ($line), $XR-SKONTO-REGEX) \n                                and\n                                matches( cac:PaymentTerms/cbc:Note[1]/tokenize(. ,  '#.+#')[last()], '^\\s*\\n' )",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-21",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-DE-21] Das Element \"Specification identifier\" (BT-24) soll syntaktisch der Kennung des Standards XRechnung entsprechen.",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "cbc:CustomizationID = $XR-CIUS-ID or\n                    cbc:CustomizationID = $XR-EXTENSION-ID or\n                    cbc:CustomizationID = $XR-CVD-ID",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-22",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-22] Das \"filename\"-Attribut aller \"EmbeddedDocumentBinaryObject\"-Elemente muss eindeutig sein",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "count(cac:AdditionalDocumentReference) = \n                    count(cac:AdditionalDocumentReference[not(./cac:Attachment/cbc:EmbeddedDocumentBinaryObject/@filename = preceding-sibling::cac:AdditionalDocumentReference/cac:Attachment/cbc:EmbeddedDocumentBinaryObject/@filename)])",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-26",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-DE-26] Wenn im Element \"Invoice type code\" (BT-3) der Code 384 (Corrected invoice) übergeben wird, soll PRECEDING INVOICE REFERENCE BG-3 mind. einmal vorhanden sein.",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "((not(normalize-space(cbc:InvoiceTypeCode) = '384' or normalize-space(cbc:CreditNoteTypeCode) = '384') or\n                    (cac:BillingReference/cac:InvoiceDocumentReference)))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-30",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-30] Wenn \"DIRECT DEBIT\" BG-19 vorhanden ist, dann muss \"Bank assigned creditor identifier\" BT-90 übermittelt werden.",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "not(cac:PaymentMeans/cac:PaymentMandate) \n                      or (cac:AccountingSupplierParty/cac:Party/cac:PartyIdentification/cbc:ID[@schemeID='SEPA'] \n                        | cac:PayeeParty/cac:PartyIdentification/cbc:ID[@schemeID='SEPA'])",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-31",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-31] Wenn \"DIRECT DEBIT\" BG-19 vorhanden ist, dann muss \"Debited account identifier\" BT-91 übermittelt werden.",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "not(cac:PaymentMeans/cac:PaymentMandate) or (cac:PaymentMeans/cac:PaymentMandate/cac:PayerFinancialAccount/cbc:ID)",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-TMP-32",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "information",
              "text": "[BR-DE-TMP-32] Eine Rechnung sollte zur Angabe des Liefer-/Leistungsdatums entweder BT-72 \"Actual delivery date\", BG-14 \"Invoicing period\" oder in jeder Rechnungsposition BG-26 \"Invoice line period\" enthalten.",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "cac:Delivery/cbc:ActualDeliveryDate\n        or cac:InvoicePeriod\n        or (every $line in (cac:InvoiceLine | cac:CreditNoteLine) satisfies $line/cac:InvoicePeriod)",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-TMP-2",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-TMP-2] BT-124 \"External document location\" muss eine absolute URL mit gültigem Schema enthalten.",
              "context": "/ubl:Invoice/cac:AdditionalDocumentReference/cac:Attachment/cac:ExternalReference | /cn:CreditNote/cac:AdditionalDocumentReference/cac:Attachment/cac:ExternalReference",
              "test": "matches(cbc:URI, $XR-URL-REGEX)",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-TMP-6",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-TMP-6] Datumsangaben in UBL müssen im Format JJJJ-MM-TT (YYYY-MM-DD) übermittelt werden.",
              "context": "cbc:IssueDate | cbc:DueDate | cbc:StartDate | cbc:EndDate | cbc:ActualDeliveryDate | \n      cbc:IssueDate | cbc:TaxPointDate | cbc:PaymentDueDate",
              "test": "matches(normalize-space(text()), '^\\d{4}-\\d{2}-\\d{2}$')",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-2",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-2] Die Gruppe \"SELLER CONTACT\" (BG-6) muss übermittelt werden.",
              "context": "/ubl:Invoice/cac:AccountingSupplierParty | /cn:CreditNote/cac:AccountingSupplierParty",
              "test": "cac:Party/cac:Contact",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-3",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-3] Das Element \"Seller city\" (BT-37) muss übermittelt werden.",
              "context": "/ubl:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PostalAddress | /cn:CreditNote/cac:AccountingSupplierParty/cac:Party/cac:PostalAddress",
              "test": "cbc:CityName[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-4",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-4] Das Element \"Seller post code\" (BT-38) muss übermittelt werden.",
              "context": "/ubl:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PostalAddress | /cn:CreditNote/cac:AccountingSupplierParty/cac:Party/cac:PostalAddress",
              "test": "cbc:PostalZone[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-5",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-5] Das Element \"Seller contact point\" (BT-41) muss übermittelt werden.",
              "context": "/ubl:Invoice/cac:AccountingSupplierParty/cac:Party/cac:Contact | /cn:CreditNote/cac:AccountingSupplierParty/cac:Party/cac:Contact",
              "test": "cbc:Name[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-6",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-6] Das Element \"Seller contact telephone number\" (BT-42) muss übermittelt werden.",
              "context": "/ubl:Invoice/cac:AccountingSupplierParty/cac:Party/cac:Contact | /cn:CreditNote/cac:AccountingSupplierParty/cac:Party/cac:Contact",
              "test": "cbc:Telephone[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-7",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-7] Das Element \"Seller contact email address\" (BT-43) muss übermittelt werden.",
              "context": "/ubl:Invoice/cac:AccountingSupplierParty/cac:Party/cac:Contact | /cn:CreditNote/cac:AccountingSupplierParty/cac:Party/cac:Contact",
              "test": "cbc:ElectronicMail[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-27",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-DE-27] In BT-42 sollen mindestens drei Ziffern enthalten sein.",
              "context": "/ubl:Invoice/cac:AccountingSupplierParty/cac:Party/cac:Contact | /cn:CreditNote/cac:AccountingSupplierParty/cac:Party/cac:Contact",
              "test": "matches(normalize-space(cbc:Telephone), $XR-TELEPHONE-REGEX)",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-28",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-DE-28] In BT-43 soll genau ein @-Zeichen enthalten sein, welches nicht von einem Leerzeichen, einem Punkt, aber mindestens zwei Zeichen auf beiden Seiten flankiert werden soll. Ein Punkt sollte nicht am Anfang oder am Ende stehen.",
              "context": "/ubl:Invoice/cac:AccountingSupplierParty/cac:Party/cac:Contact | /cn:CreditNote/cac:AccountingSupplierParty/cac:Party/cac:Contact",
              "test": "matches(normalize-space(cbc:ElectronicMail), $XR-EMAIL-REGEX)",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-8",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-8] Das Element \"Buyer city\" (BT-52) muss übermittelt werden.",
              "context": "/ubl:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PostalAddress | /cn:CreditNote/cac:AccountingCustomerParty/cac:Party/cac:PostalAddress",
              "test": "cbc:CityName[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-9",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-9] Das Element \"Buyer post code\" (BT-53) muss übermittelt werden.",
              "context": "/ubl:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PostalAddress | /cn:CreditNote/cac:AccountingCustomerParty/cac:Party/cac:PostalAddress",
              "test": "cbc:PostalZone[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-10",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-10] Das Element \"Deliver to city\" (BT-77) muss übermittelt werden, wenn die Gruppe \"DELIVER TO ADDRESS\" (BG-15) übermittelt wird.",
              "context": "/ubl:Invoice/cac:Delivery/cac:DeliveryLocation/cac:Address | /cn:CreditNote/cac:Delivery/cac:DeliveryLocation/cac:Address",
              "test": "cbc:CityName[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-11",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-11] Das Element \"Deliver to post code\" (BT-78) muss übermittelt werden, wenn die Gruppe \"DELIVER TO ADDRESS\" (BG-15) übermittelt wird.",
              "context": "/ubl:Invoice/cac:Delivery/cac:DeliveryLocation/cac:Address | /cn:CreditNote/cac:Delivery/cac:DeliveryLocation/cac:Address",
              "test": "cbc:PostalZone[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-19",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-DE-19] \"Payment account identifier\" (BT-84) soll eine korrekte IBAN enthalten, wenn in \"Payment means type code\" (BT-81) mit dem Code 58 SEPA als Zahlungsmittel gefordert wird.",
              "context": "/ubl:Invoice/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('30','58')] | /cn:CreditNote/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('30','58')]",
              "test": "not(normalize-space(cbc:PaymentMeansCode) = '58') or\n                    xr:checkIBAN(string(cac:PayeeFinancialAccount/cbc:ID))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-23-a",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-23-a] Wenn BT-81 \"Payment means type code\" einen Schlüssel für Überweisungen enthält (30, 58), muss BG-17 \"CREDIT TRANSFER\" übermittelt werden.",
              "context": "/ubl:Invoice/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('30','58')] | /cn:CreditNote/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('30','58')]",
              "test": "cac:PayeeFinancialAccount",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-23-b",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-23-b] Wenn BT-81 \"Payment means type code\" einen Schlüssel für Überweisungen enthält (30, 58), dürfen BG-18 und BG-19 nicht übermittelt werden.",
              "context": "/ubl:Invoice/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('30','58')] | /cn:CreditNote/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('30','58')]",
              "test": "not(cac:CardAccount) and\n                    not(cac:PaymentMandate)",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-24-a",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-24-a] Wenn BT-81 \"Payment means type code\" einen Schlüssel für Kartenzahlungen enthält (48, 54, 55), muss genau BG-18 \"PAYMENT CARD INFORMATION\" übermittelt werden.",
              "context": "/ubl:Invoice/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('48','54','55')] |/cn:CreditNote/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('48','54','55')]",
              "test": "cac:CardAccount",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-24-b",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-24-b] Wenn BT-81 \"Payment means type code\" einen Schlüssel für Kartenzahlungen enthält (48, 54, 55), dürfen BG-17 und BG-19 nicht übermittelt werden.",
              "context": "/ubl:Invoice/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('48','54','55')] |/cn:CreditNote/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('48','54','55')]",
              "test": "not(cac:PayeeFinancialAccount) and\n                    not(cac:PaymentMandate)",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-20",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-DE-20] \"Debited account identifier\" (BT-91) soll eine korrekte IBAN enthalten, wenn in \"Payment means type code\" (BT-81) mit dem Code 59 SEPA als Zahlungsmittel gefordert wird.",
              "context": "/ubl:Invoice/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = '59'] | /cn:CreditNote/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = '59']",
              "test": "not(normalize-space(cbc:PaymentMeansCode) = '59') or\n                    xr:checkIBAN(string(cac:PaymentMandate/cac:PayerFinancialAccount/cbc:ID))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-25-a",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-25-a] Wenn BT-81 \"Payment means type code\" einen Schlüssel für Lastschriften enthält (59), muss genau BG-19 \"DIRECT DEBIT\" übermittelt werden.",
              "context": "/ubl:Invoice/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = '59'] | /cn:CreditNote/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = '59']",
              "test": "cac:PaymentMandate",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-25-b",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-25-b] Wenn BT-81 \"Payment means type code\" einen Schlüssel für Lastschriften enthält (59), dürfen BG-17 und BG-18 nicht übermittelt werden.",
              "context": "/ubl:Invoice/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = '59'] | /cn:CreditNote/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = '59']",
              "test": "not(cac:PayeeFinancialAccount) and\n                    not(cac:CardAccount)",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-14",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-14] Das Element \"VAT category rate\" (BT-119) muss übermittelt werden.",
              "context": "/ubl:Invoice/cac:TaxTotal/cac:TaxSubtotal | /cn:CreditNote/cac:TaxTotal/cac:TaxSubtotal",
              "test": "cac:TaxCategory/cbc:Percent[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-01",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DEX-01] Das Element  \"Attached Document\" (BT-125) benutzt einen nicht zulässigen MIME-Code: . Im Falle einer Extension darf zusätzlich zu der Liste der mime codes (definiert in Abschnitt 8.2, \"Binary Object\") der MIME-Code application/xml genutzt werden.",
              "context": "cbc:EmbeddedDocumentBinaryObject[$isExtension]",
              "test": ".[@mimeCode = 'application/pdf' or\n        @mimeCode = 'image/png' or\n        @mimeCode = 'image/jpeg' or\n        @mimeCode = 'text/csv' or\n        @mimeCode = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' or\n        @mimeCode = 'application/vnd.oasis.opendocument.spreadsheet' or\n        @mimeCode = 'application/xml']",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-02",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "warning",
              "text": "[BR-DEX-02] Der Wert von \"Invoice line net amount\" (BT-131) einer \"INVOICE LINE\"\n        (BG-25) oder einer \"SUB INVOICE LINE\" (BG-DEX-01) soll der Summe\n        der \"Invoice line net amount\" (BT-131) der direkt darunterliegenden \"SUB\n        INVOICE LINE\" (BG-DEX-01) entsprechen.",
              "context": "/ubl:Invoice[$isExtension]",
              "test": "(every $invoiceline \n        in /ubl:Invoice/cac:InvoiceLine[ exists (./cac:SubInvoiceLine) ] \n        satisfies $invoiceline/xs:decimal(cbc:LineExtensionAmount) = sum($invoiceline/cac:SubInvoiceLine/xs:decimal(cbc:LineExtensionAmount))) and\n        (count( //cac:SubInvoiceLine [count(cac:SubInvoiceLine) > 0 and xs:decimal(cbc:LineExtensionAmount) = sum(cac:SubInvoiceLine/xs:decimal(cbc:LineExtensionAmount))]) = count(//cac:SubInvoiceLine [count(cac:SubInvoiceLine) > 0]))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-03",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DEX-03] Eine Sub Invoice Line (BG-DEX-01) muss genau eine \"SUB INVOICE LINE VAT INFORMATION\" (BG-DEX-06) enthalten.",
              "context": "/ubl:Invoice[$isExtension]",
              "test": "not(exists(//cac:SubInvoiceLine/cac:Item[ count ( cac:ClassifiedTaxCategory) != 1]))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-09",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DEX-09] Amount due for payment (BT-115) = Invoice total amount with VAT (BT-112) - Paid amount (BT-113) + Rounding amount (BT-114) + Σ Third party payment amount (BT-DEX-002).",
              "context": "cac:LegalMonetaryTotal[$isExtension]",
              "test": "(round((xs:decimal(cbc:PayableAmount) - $payableroundingamount) * 10 * 10) div 100) = (round((xs:decimal(cbc:TaxInclusiveAmount) - $prepaidamount + $thirdpartyprepaidamount) * 10 * 10) div 100)",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-04",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DEX-04] Any scheme identifier in  MUST be coded using one of the ISO 6523 ICD list.",
              "context": "cac:PartyIdentification/cbc:ID[@schemeID and $isExtension]",
              "test": "((not(contains(normalize-space(@schemeID), ' ')) and contains($ISO-6523-ICD-EXT-CODES, concat(' ', normalize-space(@schemeID), ' '))))  or ((not(contains(normalize-space(@schemeID), ' ')) and contains(' SEPA ', concat(' ', normalize-space(@schemeID), ' '))) and ((ancestor::cac:AccountingSupplierParty) or (ancestor::cac:PayeeParty)))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-05",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DEX-05] Any scheme identifier in  MUST be coded using one of the ISO 6523 ICD list.",
              "context": "cac:PartyLegalEntity/cbc:CompanyID[@schemeID and $isExtension]",
              "test": "((not(contains(normalize-space(@schemeID), ' ')) and contains($ISO-6523-ICD-EXT-CODES, concat(' ', normalize-space(@schemeID), ' '))))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-06",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DEX-06] Any scheme identifier in  MUST be coded using one of the ISO 6523 ICD list.",
              "context": "cac:StandardItemIdentification/cbc:ID[@schemeID and $isExtension]",
              "test": "((not(contains(normalize-space(@schemeID), ' ')) and contains($ISO-6523-ICD-EXT-CODES, concat(' ', normalize-space(@schemeID), ' '))))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-07",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DEX-07] Any scheme identifier for an Endpoint Identifier in  MUST belong to the CEF EAS code list.",
              "context": "cbc:EndpointID[@schemeID and $isExtension]",
              "test": "((not(contains(normalize-space(@schemeID), ' ')) and contains($CEF-EAS-EXT-CODES, concat(' ', normalize-space(@schemeID), ' '))))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-08",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DEX-08] Any scheme identifier for a Delivery location identifier in  MUST be coded using one of the ISO 6523 ICD list.",
              "context": "cac:DeliveryLocation/cbc:ID[@schemeID and $isExtension]",
              "test": "((not(contains(normalize-space(@schemeID), ' ')) and contains($ISO-6523-ICD-EXT-CODES, concat(' ', normalize-space(@schemeID), ' '))))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-10",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DEX-10] Das Element \"Third party payment type\" BT-DEX-001 muss übermittelt werden, wenn die Gruppe \"THIRD PARTY PAYMENT\" (BG-DEX-09) übermittelt wird.",
              "context": "/ubl:Invoice/cac:PrepaidPayment[$isExtension]",
              "test": "cbc:ID[boolean(normalize-space(xs:string(.)))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-11",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DEX-11] Das Element \"Third party payment amount\" BT-DEX-002 muss übermittelt werden, wenn die Gruppe \"THIRD PARTY PAYMENT\" (BG-DEX-09) übermittelt wird.",
              "context": "/ubl:Invoice/cac:PrepaidPayment[$isExtension]",
              "test": "cbc:PaidAmount[boolean(normalize-space(xs:string(.)))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-12",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DEX-12] Das Element \"Third party payment description\" BT-DEX-003 muss übermittelt werden, wenn die Gruppe \"THIRD PARTY PAYMENT\" (BG-DEX-09) übermittelt wird.",
              "context": "/ubl:Invoice/cac:PrepaidPayment[$isExtension]",
              "test": "cbc:InstructionID[boolean(normalize-space(xs:string(.)))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-13",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DEX-13] Die maximale Anzahl zulässiger Nachkommastellen für das Element \"Third party payment amount\" (BT-DEX-002) ist 2.",
              "context": "/ubl:Invoice/cac:PrepaidPayment[$isExtension]",
              "test": "string-length(substring-after(cbc:PaidAmount, '.')) <= 2",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DEX-14",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DEX-14] Die Währungsangabe von \"Third party payment amount\" BT-DEX-002 muss BT-5 (\"Invoice currency code\") entsprechen.",
              "context": "/ubl:Invoice/cac:PrepaidPayment[$isExtension]",
              "test": "cbc:PaidAmount/@currencyID = parent::node()/cbc:DocumentCurrencyCode",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-CVD-02",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-CVD-02] Das Element  \"Tender or lot reference\" (BT-17) muss übermittelt werden.",
              "context": "(/ubl:Invoice | /cn:CreditNote)[$isCVD]",
              "test": "cac:OriginatorDocumentReference/cbc:ID[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-CVD-01",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-CVD-01] Das Element  \"Contract reference\" (BT-12) muss übermittelt werden.",
              "context": "(/ubl:Invoice | /cn:CreditNote)[$isCVD]",
              "test": "cac:ContractDocumentReference/cbc:ID[boolean(normalize-space(.))]",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-CVD-03",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-CVD-03] In einer Rechnung muss mindestens eine  INVOICE LINE (BG-25) enthalten sein, in der der Scheme identifier von  \"Item classification identifier\" (BT-158) den Wert 'CVD' und der  \"Item attribute name\" (BT-160) den Wert 'cva' enthält.",
              "context": "(/ubl:Invoice | /cn:CreditNote)[$isCVD]",
              "test": "(cac:InvoiceLine/cac:Item | cac:CreditNoteLine/cac:Item)[cac:CommodityClassification/cbc:ItemClassificationCode/@listID = 'CVD'\n        and\n        cac:AdditionalItemProperty/cbc:Name = 'cva']",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-CVD-06-a",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-CVD-06-a] Wenn der Scheme identifier von  \"Item classification identifier\" (BT-158) mit dem Wert 'CVD' angegeben ist, muss in derselben Rechnungszeile genau ein  \"Item attribute name\" (BT-160) mit dem Wert 'cva' vorhanden sein.",
              "context": "(/ubl:Invoice[$isCVD]/cac:InvoiceLine | /cn:CreditNote[$isCVD]/cac:CreditNoteLine)/cac:Item",
              "test": "not(cac:CommodityClassification/cbc:ItemClassificationCode[@listID = 'CVD']) or count(cac:AdditionalItemProperty[cbc:Name = 'cva']) = 1",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-CVD-06-b",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-CVD-06-b] Wenn  \"Item attribute name\" (BT-160) mit dem Wert 'cva' angegeben ist, muss in derselben Rechnungszeile genau ein  \"Item classification identifier\" (BT-158) mit dem Scheme identifier 'CVD' vorhanden sein.",
              "context": "(/ubl:Invoice[$isCVD]/cac:InvoiceLine | /cn:CreditNote[$isCVD]/cac:CreditNoteLine)/cac:Item",
              "test": "not(cac:AdditionalItemProperty[cbc:Name = 'cva']) or count(cac:CommodityClassification/cbc:ItemClassificationCode[@listID = 'CVD']) = 1",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-TMP-CVD-01",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-TMP-CVD-01] Das Bildungsschema für  \"Item classification identifier\" (BT-158) ist aus der Codeliste UNTDID 7143 zu wählen.",
              "context": "(/ubl:Invoice[$isCVD]/cac:InvoiceLine | /cn:CreditNote[$isCVD]/cac:CreditNoteLine)/cac:Item/cac:CommodityClassification/cbc:ItemClassificationCode",
              "test": "((not(contains(normalize-space(@listID), ' ')) and contains($UNTDID-7143-CVD-CODES, concat(' ', normalize-space(@listID), ' '))))",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-CVD-04",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-CVD-04] Ein  \"Item classification identifier\" (BT-158) mit dem Scheme identifier 'CVD' muss einen Wert aus der Liste der zulässigen Fahrzeugkategorien enthalten.",
              "context": "(/ubl:Invoice[$isCVD]/cac:InvoiceLine | /cn:CreditNote[$isCVD]/cac:CreditNoteLine)/cac:Item/cac:CommodityClassification/cbc:ItemClassificationCode",
              "test": "not(normalize-space(@listID) = 'CVD') or normalize-space(.) = $CVD-VEHICLE-CATEGORY",
              "phases": [
                "xrechnung-model"
              ]
            },
            {
              "id": "BR-DE-CVD-05",
              "syntax": "UBL",
              "source": "xrechnung",
              "flag": "fatal",
              "text": "[BR-DE-CVD-05] Wenn innerhalb von  ITEM ATTRIBUTES (BG-32) der  \"Item attribute name\" (BT-160) den Wert 'cva' hat, muss der  \"Item attribute value\" (BT-161) einen der zulässigen Werte enthalten.",
              "context": "(/ubl:Invoice[$isCVD]/cac:InvoiceLine | /cn:CreditNote[$isCVD]/cac:CreditNoteLine)/cac:Item/cac:AdditionalItemProperty[cbc:Name = 'cva']",
              "test": "normalize-space(cbc:Value) = $CVA-CODES",
              "phases": [
                "xrechnung-model"
              ]
            }
          ]
        }
      }
    },
    {
      "key": "peppol",
      "name": "Peppol BIS Billing 3.0",
      "note": "the network’s profile of EN 16931",
      "version": "Peppol BIS Billing 3.0 release 3.0.21 (May 2026), with EN 16931 Schematron 1.3.16",
      "syntaxes": {
        "cii": {
          "assertions": 897,
          "fatal": 409,
          "warning": 488,
          "information": 0,
          "ids": 896,
          "added": [
            {
              "id": "BR-AF-01",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-01]-An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"IGIC\" shall contain in the VAT breakdown (BG-23) at least one VAT category code (BT-118) equal with \"IGIC\".",
              "context": "/rsm:CrossIndustryInvoice",
              "test": "((count(//ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode='L']) + count(//ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode='L'])) >=2 or not (//ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode='L'])) and      ((count(//ram:CategoryTradeTax[ram:CategoryCode='L']) + count(//ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode='L'])) >=2 or not (//ram:CategoryTradeTax[ram:CategoryCode='L']))",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "BR-AG-01",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-01]-An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"IPSI\" shall contain in the VAT breakdown (BG-23) at least one VAT category code (BT-118) equal with \"IPSI\".",
              "context": "/rsm:CrossIndustryInvoice",
              "test": "((count(//ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode='M']) + count(//ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode='M'])) >=2 or not (//ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode='M'])) and      ((count(//ram:CategoryTradeTax[ram:CategoryCode='M']) + count(//ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode='M'])) >=2 or not (//ram:CategoryTradeTax[ram:CategoryCode='M']))",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "BR-AF-08",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-08]-For each different value of VAT category rate (BT-119) where the VAT category code (BT-118) is \"IGIC\", the VAT category taxable amount (BT-116) in a VAT breakdown (BG-23) shall equal the sum of Invoice line net amounts (BT-131) plus the sum of document level charge amounts (BT-99) minus the sum of document level allowance amounts (BT-92) where the VAT category code (BT-151, BT-102, BT-95) is \"IGIC\" and the VAT rate (BT-152, BT-103, BT-96) equals the VAT category rate (BT-119).",
              "context": "//rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode = 'L'][upper-case(ram:TypeCode) = 'VAT']",
              "test": "every $rate in ../ram:RateApplicablePercent/xs:decimal(.) satisfies (../ram:BasisAmount = (round(sum(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement[ram:ApplicableTradeTax/ram:CategoryCode = 'L' and ram:ApplicableTradeTax/xs:decimal(ram:RateApplicablePercent) =$rate]/ram:SpecifiedTradeSettlementLineMonetarySummation/xs:decimal(ram:LineTotalAmount)) * 10 * 10) div 100 + round(sum(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator=true() and ram:CategoryTradeTax/ram:CategoryCode='L' and ram:CategoryTradeTax/xs:decimal(ram:RateApplicablePercent)=$rate]/xs:decimal(ram:ActualAmount[1])) * 10 * 10) div 100 - round(sum(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator=false() and ram:CategoryTradeTax/ram:CategoryCode='L' and ram:CategoryTradeTax/xs:decimal(ram:RateApplicablePercent)=$rate]/xs:decimal(ram:ActualAmount[1])) * 10 * 10) div 100))",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "BR-AF-09",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-09]-The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where VAT category code (BT-118) is \"IGIC\" shall equal the VAT category taxable amount (BT-116) multiplied by the VAT category rate (BT-119).",
              "context": "//rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode = 'L'][upper-case(ram:TypeCode) = 'VAT']",
              "test": "true()",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "BR-AF-10",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-10]-A VAT Breakdown (BG-23) with VAT Category code (BT-118) \"IGIC\" shall not have a VAT exemption reason code (BT-121) or VAT exemption reason text (BT-120).",
              "context": "//rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode = 'L'][upper-case(ram:TypeCode) = 'VAT']",
              "test": "not(ram:ExemptionReason) and not (ram:ExemptionReasonCode)",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "BR-AF-02",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-02]-An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"IGIC\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).",
              "context": "//rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode = 'L'][upper-case(ram:TypeCode) = 'VAT']",
              "test": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedTaxRegistration/ram:ID[@schemeID = ('VA', 'FC')] or /rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTaxRepresentativeTradeParty/ram:SpecifiedTaxRegistration/ram:ID[@schemeID = 'VA']",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "BR-AF-05",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-05]-In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"IGIC\" the invoiced item VAT rate (BT-152) shall be greater than 0 (zero).",
              "context": "//rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode = 'L'][upper-case(ram:TypeCode) = 'VAT']",
              "test": "ram:RateApplicablePercent > 0",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "BR-AF-03",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-03]-An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"IGIC\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).",
              "context": "//ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator=false()]/ram:CategoryTradeTax[ram:CategoryCode = 'L'][upper-case(ram:TypeCode) = 'VAT']",
              "test": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedTaxRegistration/ram:ID[@schemeID = ('VA', 'FC')] or /rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTaxRepresentativeTradeParty/ram:SpecifiedTaxRegistration/ram:ID[@schemeID = 'VA']",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "BR-AF-06",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-06]-In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"IGIC\" the Document level allowance VAT rate (BT-96) shall be 0 (zero) or greater than zero.",
              "context": "//ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator=false()]/ram:CategoryTradeTax[ram:CategoryCode = 'L'][upper-case(ram:TypeCode) = 'VAT']",
              "test": "ram:RateApplicablePercent > 0",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "BR-AF-04",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-04]-An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"IGIC\" shall contain the Seller VAT Identifier (BT-31), the Seller Tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).",
              "context": "//ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator=true()]/ram:CategoryTradeTax[ram:CategoryCode = 'L'][upper-case(ram:TypeCode) = 'VAT']",
              "test": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedTaxRegistration/ram:ID[@schemeID = ('VA', 'FC')] or /rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTaxRepresentativeTradeParty/ram:SpecifiedTaxRegistration/ram:ID[@schemeID = 'VA']",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "BR-AF-07",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-07]-In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"IGIC\" the Document level charge VAT rate (BT-103) shall be 0 (zero) or greater than zero.",
              "context": "//ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator=true()]/ram:CategoryTradeTax[ram:CategoryCode = 'L'][upper-case(ram:TypeCode) = 'VAT']",
              "test": "ram:RateApplicablePercent > 0",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "BR-AG-08",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-08]-For each different value of VAT category rate (BT-119) where the VAT category code (BT-118) is \"IPSI\", the VAT category taxable amount (BT-116) in a VAT breakdown (BG-23) shall equal the sum of Invoice line net amounts (BT-131) plus the sum of document level charge amounts (BT-99) minus the sum of document level allowance amounts (BT-92) where the VAT category code (BT-151, BT-102, BT-95) is \"IPSI\" and the VAT rate (BT-152, BT-103, BT-96) equals the VAT category rate (BT-119).",
              "context": "//rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode = 'M'][upper-case(ram:TypeCode) = 'VAT']",
              "test": "every $rate in ../ram:RateApplicablePercent/xs:decimal(.) satisfies (../ram:BasisAmount = (round(sum(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement[ram:ApplicableTradeTax/ram:CategoryCode = 'M' and ram:ApplicableTradeTax/xs:decimal(ram:RateApplicablePercent) =$rate]/ram:SpecifiedTradeSettlementLineMonetarySummation/xs:decimal(ram:LineTotalAmount)) * 10 * 10) div 100 + round(sum(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator=true() and ram:CategoryTradeTax/ram:CategoryCode='M' and ram:CategoryTradeTax/xs:decimal(ram:RateApplicablePercent)=$rate]/xs:decimal(ram:ActualAmount[1])) * 10 * 10) div 100 - round(sum(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator=false() and ram:CategoryTradeTax/ram:CategoryCode='M' and ram:CategoryTradeTax/xs:decimal(ram:RateApplicablePercent)=$rate]/xs:decimal(ram:ActualAmount[1])) * 10 * 10) div 100))",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "BR-AG-09",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-09]-The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where VAT category code (BT-118) is \"IPSI\" shall equal the VAT category taxable amount (BT-116) multiplied by the VAT category rate (BT-119).",
              "context": "//rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode = 'M'][upper-case(ram:TypeCode) = 'VAT']",
              "test": "true()",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "BR-AG-10",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-10]-A VAT Breakdown (BG-23) with VAT Category code (BT-118) \"IPSI\" shall not have a VAT exemption reason code (BT-121) or VAT exemption reason text (BT-120).",
              "context": "//rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode = 'M'][upper-case(ram:TypeCode) = 'VAT']",
              "test": "not(ram:ExemptionReason) and not (ram:ExemptionReasonCode)",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "BR-AG-02",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-02]-An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"IPSI\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).",
              "context": "//rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode = 'M'][upper-case(ram:TypeCode) = 'VAT']",
              "test": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedTaxRegistration/ram:ID[@schemeID = ('VA', 'FC')] or /rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTaxRepresentativeTradeParty/ram:SpecifiedTaxRegistration/ram:ID[@schemeID = 'VA']",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "BR-AG-05",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-05]-In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"IPSI\" the Invoiced item VAT rate (BT-152) shall be 0 (zero) or greater than zero.",
              "context": "//rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode = 'M'][upper-case(ram:TypeCode) = 'VAT']",
              "test": "ram:RateApplicablePercent >= 0",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "BR-AG-03",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-03]-An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"IPSI\" shall contain the Seller VAT Identifier (BT-31), the Seller Tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).",
              "context": "//ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator=false()]/ram:CategoryTradeTax[ram:CategoryCode = 'M'][upper-case(ram:TypeCode) = 'VAT']",
              "test": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedTaxRegistration/ram:ID[@schemeID = ('VA', 'FC')] or /rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTaxRepresentativeTradeParty/ram:SpecifiedTaxRegistration/ram:ID[@schemeID = 'VA']",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "BR-AG-06",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-06]-In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"IPSI\" the Document level allowance VAT rate (BT-96) shall be 0 (zero) or greater than zero.",
              "context": "//ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator=false()]/ram:CategoryTradeTax[ram:CategoryCode = 'M'][upper-case(ram:TypeCode) = 'VAT']",
              "test": "ram:RateApplicablePercent >= 0",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "BR-AG-04",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-04]-An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"IPSI\" shall contain the Seller VAT Identifier (BT-31), the Seller Tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).",
              "context": "//ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator=true()]/ram:CategoryTradeTax[ram:CategoryCode = 'M'][upper-case(ram:TypeCode) = 'VAT']",
              "test": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedTaxRegistration/ram:ID[@schemeID = ('VA', 'FC')] or /rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTaxRepresentativeTradeParty/ram:SpecifiedTaxRegistration/ram:ID[@schemeID = 'VA']",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "BR-AG-07",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-07]-In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"IPSI\" the Document level charge VAT rate (BT-103) shall be 0 (zero) or greater than zero.",
              "context": "//ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator=true()]/ram:CategoryTradeTax[ram:CategoryCode = 'M'][upper-case(ram:TypeCode) = 'VAT']",
              "test": "ram:RateApplicablePercent >= 0",
              "phases": [
                "EN16931-model-phase"
              ]
            },
            {
              "id": "CII-SR-464",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "warning",
              "text": "[CII-SR-464] - PayerSpecifiedDebtorFincancialInstitution shall not be used.",
              "context": "//ram:SpecifiedTradeSettlementPaymentMeans",
              "test": "not(ram:PayerSpecifiedDebtorFinancialInstitution)",
              "phases": [
                "syntax_phase"
              ]
            },
            {
              "id": "CII-SR-471",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[CII-SR-471]-Each Specified Trade Allowance Charge (BG-20)(BG-21) shall contain a VAT category code (BT-95).",
              "context": "//ram:SpecifiedTradeAllowanceCharge",
              "test": "count(ram:RateApplicablePercent) <= 1",
              "phases": [
                "syntax_phase"
              ]
            },
            {
              "id": "CII-SR-472",
              "syntax": "CII",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[CII-SR-472]-Each Specified Trade Allowance Charge (BG-20)(BG-21) should contain a VAT rate (BT-96).",
              "context": "//ram:SpecifiedTradeAllowanceCharge",
              "test": "count(ram:CategoryTradeTax) <= 1",
              "phases": [
                "syntax_phase"
              ]
            },
            {
              "id": "PEPPOL-EN16931-R001",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R001]-Business process MUST be provided.",
              "context": "rsm:ExchangedDocumentContext",
              "test": "ram:BusinessProcessSpecifiedDocumentContextParameter/ram:ID",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R007",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R007]-Business process MUST have an approved profile identifier.",
              "context": "rsm:ExchangedDocumentContext",
              "test": "$profile != 'Unknown'",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R004",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R004]-Specification identifier MUST begin with the value 'urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0' and follow the format rules for the identifier.",
              "context": "rsm:ExchangedDocumentContext",
              "test": "starts-with(normalize-space(ram:GuidelineSpecifiedDocumentContextParameter/ram:ID/text()),\n      'urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0') and not(contains(normalize-space(ram:GuidelineSpecifiedDocumentContextParameter/ram:ID/text()), '::'))",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R003",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R003]-A buyer reference or purchase order reference MUST be provided.",
              "context": "ram:ApplicableHeaderTradeAgreement",
              "test": "ram:BuyerReference or ram:BuyerOrderReferencedDocument/ram:IssuerAssignedID",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R006",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R006]-Only one invoiced object is allowed on document level",
              "context": "ram:ApplicableHeaderTradeAgreement",
              "test": "count(ram:AdditionalReferencedDocument[ram:TypeCode='130']) <=1",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R080",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R080]-Only one project reference is allowed on document level",
              "context": "ram:ApplicableHeaderTradeAgreement",
              "test": "count(ram:AdditionalReferencedDocument[ram:TypeCode='50']) <=1",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R005",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R005]-VAT accounting currency code MUST be different from invoice currency code when provided.",
              "context": "ram:ApplicableHeaderTradeSettlement",
              "test": "not(ram:TaxCurrencyCode) or normalize-space(ram:TaxCurrencyCode/text()) != normalize-space(ram:InvoiceCurrencyCode/text())",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R053",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R053]-Only one tax total with tax subtotals MUST be provided.",
              "context": "ram:ApplicableHeaderTradeSettlement",
              "test": "count(ram:SpecifiedTradeSettlementHeaderMonetarySummation/ram:TaxTotalAmount[@currencyID = $documentCurrencyCode]) = 1",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R054",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R054]-Only one tax total without tax subtotals MUST be provided when tax currency code is provided.",
              "context": "ram:ApplicableHeaderTradeSettlement",
              "test": "\n                    count(ram:SpecifiedTradeSettlementHeaderMonetarySummation/ram:TaxTotalAmount[@currencyID != $documentCurrencyCode]) = (if (ram:TaxCurrencyCode) then\n                        1\n                    else\n                        0)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R055",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R055]-Invoice total VAT amount and Invoice total VAT amount in accounting currency MUST have the same operational sign",
              "context": "ram:ApplicableHeaderTradeSettlement",
              "test": "not(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:TaxCurrencyCode) or (ram:SpecifiedTradeSettlementHeaderMonetarySummation/ram:TaxTotalAmount[@currencyID = $taxCurrencyCode] < 0 and ram:SpecifiedTradeSettlementHeaderMonetarySummation/ram:TaxTotalAmount[@currencyID = $documentCurrencyCode] < 0) or (ram:SpecifiedTradeSettlementHeaderMonetarySummation/ram:TaxTotalAmount[@currencyID = $taxCurrencyCode] >= 0 and ram:SpecifiedTradeSettlementHeaderMonetarySummation/ram:TaxTotalAmount[@currencyID = $documentCurrencyCode] >= 0)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R002",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R002]-No more than one note is allowed on document level.",
              "context": "rsm:ExchangedDocument",
              "test": "count(ram:IncludedNote) <= 1 and not(ram:IncludedNote/ram:SubjectCode)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R010",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R010]-Buyer electronic address MUST be provided",
              "context": "ram:BuyerTradeParty",
              "test": "ram:URIUniversalCommunication/ram:URIID",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R020",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R020]-Seller electronic address MUST be provided",
              "context": "ram:SellerTradeParty",
              "test": "ram:URIUniversalCommunication/ram:URIID",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R041",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R041]-Allowance/charge base\n                amount MUST be provided when allowance/charge percentage is provided.",
              "context": "ram:SpecifiedTradeAllowanceCharge[ram:CalculationPercent and not(ram:BasisAmount)]",
              "test": "false()",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R042",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R042]-Allowance/charge percentage\n                MUST be provided when allowance/charge base amount is provided.",
              "context": "ram:SpecifiedTradeAllowanceCharge[not(ram:CalculationPercent) and ram:BasisAmount]",
              "test": "false()",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R040",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R040]-Allowance/charge amount must equal base amount * percentage/100 if base amount and percentage exists",
              "context": "ram:SpecifiedTradeAllowanceCharge",
              "test": "\n                    not(ram:CalculationPercent and ram:BasisAmount) or u:slack(if (ram:ActualAmount) then\n                        ram:ActualAmount\n                    else\n                        0, (xs:decimal(ram:BasisAmount) * xs:decimal(ram:CalculationPercent)) div 100, 0.02)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R043",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R043]-Allowance/charge ChargeIndicator value MUST equal 'true' or 'false'",
              "context": "ram:SpecifiedTradeAllowanceCharge",
              "test": "normalize-space(ram:ChargeIndicator/udt:Indicator/text()) = 'true' or normalize-space(ram:ChargeIndicator/udt:Indicator/text()) = 'false'",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R043",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R043]-Allowance/charge ChargeIndicator value MUST equal 'true' or 'false'",
              "context": "ram:AppliedTradeAllowanceCharge",
              "test": "normalize-space(ram:ChargeIndicator/udt:Indicator/text()) = 'true' or normalize-space(ram:ChargeIndicator/udt:Indicator/text()) = 'false'",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R061",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R061]-Mandate reference MUST be provided for direct debit.",
              "context": "\n                ram:SpecifiedTradeSettlementPaymentMeans[some $code in tokenize('49 59', '\\s')\n                    satisfies normalize-space(ram:TypeCode) = $code]",
              "test": "../ram:SpecifiedTradePaymentTerms/ram:DirectDebitMandateID",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R110",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R110]-Start date of line period MUST be within invoice period.",
              "context": "rsm:SupplyChainTradeTransaction[ram:ApplicableHeaderTradeSettlement/ram:BillingSpecifiedPeriod/ram:StartDateTime]/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:BillingSpecifiedPeriod/ram:StartDateTime",
              "test": "udt:DateTimeString >= ../../../../ram:ApplicableHeaderTradeSettlement/ram:BillingSpecifiedPeriod/ram:StartDateTime/udt:DateTimeString",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R111",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R111]-End date of line period MUST be within invoice period.",
              "context": "rsm:SupplyChainTradeTransaction[ram:ApplicableHeaderTradeSettlement/ram:BillingSpecifiedPeriod/ram:EndDateTime]/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:BillingSpecifiedPeriod/ram:EndDateTime",
              "test": "udt:DateTimeString <= ../../../../ram:ApplicableHeaderTradeSettlement/ram:BillingSpecifiedPeriod/ram:EndDateTime/udt:DateTimeString",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R120",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R120]-Invoice line net amount MUST equal (Invoiced quantity * (Item net price/item price base quantity) + Sum of invoice line charge amount - sum of invoice line allowance amount",
              "context": "ram:IncludedSupplyChainTradeLineItem",
              "test": "u:slack($lineExtensionAmount, ($quantity * ($priceAmount div $baseQuantity)) + $chargesTotal - $allowancesTotal, 0.02)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R100",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R100]-Only one invoiced object is allowed pr line",
              "context": "ram:IncludedSupplyChainTradeLineItem",
              "test": "count(ram:SpecifiedLineTradeSettlement/ram:AdditionalReferencedDocument[ram:TypeCode='130']) <=1",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R101",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R101]-Element Document reference can only be used for Invoice line object",
              "context": "ram:IncludedSupplyChainTradeLineItem",
              "test": "(not(ram:SpecifiedLineTradeSettlement/ram:AdditionalReferencedDocument) or (ram:SpecifiedLineTradeSettlement/ram:AdditionalReferencedDocument/ram:TypeCode='130'))",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R121",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R121]-Base quantity MUST be a positive number above zero.",
              "context": "ram:NetPriceProductTradePrice | ram:GrossPriceProductTradePrice",
              "test": "not(ram:BasisQuantity) or xs:decimal(ram:BasisQuantity) > 0",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R130",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R130]-Unit code of price base quantity MUST be same as invoiced quantity.",
              "context": "ram:NetPriceProductTradePrice/ram:BasisQuantity[@unitCode] | ram:GrossPriceProductTradePrice/ram:BasisQuantity[@unitCode]",
              "test": "@unitCode = ../../../ram:SpecifiedLineTradeDelivery/ram:BilledQuantity/@unitCode",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R040",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-COMMON-R040]-GLN must have a valid format according to GS1 rules.",
              "context": "ram:URIID[@schemeID = '0088'] | ram:ID[@schemeID = '0088'] | ram:GlobalID[@schemeID = '0088']",
              "test": "matches(normalize-space(), '^[0-9]+$') and u:gln(normalize-space())",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R041",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-COMMON-R041]-Norwegian organization number MUST be stated in the correct format.",
              "context": "ram:URIID[@schemeID = '0192'] | ram:ID[@schemeID = '0192'] | ram:GlobalID[@schemeID = '0192']",
              "test": "matches(normalize-space(), '^[0-9]{9}$') and u:mod11(normalize-space())",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R042",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-COMMON-R042]-Danish organization number (CVR) MUST be stated in the correct format.",
              "context": "ram:URIID[@schemeID = '0184'] | ram:ID[@schemeID = '0184'] | ram:GlobalID[@schemeID = '0184']",
              "test": "(string-length(string()) = 10) and (substring(string(), 1, 2) = 'DK') and (string-length(translate(substring(string(), 3, 8), '1234567890', '')) = 0)\n               or\n              (string-length(string()) = 8) and (string-length(translate(substring(string(), 1, 8),'1234567890', '')) = 0)",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R052",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-COMMON-R052]-Danish chamber of commerce number (P) MUST be stated in the correct format.",
              "context": "ram:URIID[@schemeID = '0096'] | ram:ID[@schemeID = '0096'] | ram:GlobalID[@schemeID = '0096']",
              "test": "(string-length(string()) = 10) and (string-length(translate(substring(string(), 1, 10),'1234567890', '')) = 0)",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R053",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-COMMON-R053]-Danish ERSTORG number (SE) MUST be stated in the correct format.",
              "context": "ram:URIID[@schemeID = '0198'] | ram:ID[@schemeID = '0198'] | ram:GlobalID[@schemeID = '0198']",
              "test": "(string-length(string()) = 10) and (substring(string(), 1, 2) = 'DK') and (string-length(translate(substring(string(), 3, 8), '1234567890', '')) = 0)",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R043",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-COMMON-R043]-Belgian enterprise number MUST be stated in the correct format.",
              "context": "ram:URIID[@schemeID = '0208'] | ram:ID[@schemeID = '0208'] | ram:GlobalID[@schemeID = '0208']",
              "test": "matches(normalize-space(), '^[0-9]{10}$') and u:mod97-0208(normalize-space())",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R044",
              "syntax": "CII",
              "source": "peppol",
              "flag": "warning",
              "text": "[PEPPOL-COMMON-R044]-IPA Code (Codice Univoco Unità Organizzativa) must be stated in the correct format",
              "context": "ram:URIID[@schemeID = '0201'] | ram:ID[@schemeID = '0201'] | ram:GlobalID[@schemeID = '0201']",
              "test": "u:checkCodiceIPA(normalize-space())",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R045",
              "syntax": "CII",
              "source": "peppol",
              "flag": "warning",
              "text": "[PEPPOL-COMMON-R045]-Tax Code (Codice Fiscale) must be stated in the correct format",
              "context": "ram:URIID[@schemeID = '0210'] | ram:ID[@schemeID = '0210'] | ram:GlobalID[@schemeID = '0210']",
              "test": "u:checkCF(normalize-space())",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R046",
              "syntax": "CII",
              "source": "peppol",
              "flag": "warning",
              "text": "[PEPPOL-COMMON-R046]-Tax Code (Codice Fiscale) must be stated in the correct format",
              "context": "ram:URIID[@schemeID = '9907']",
              "test": "u:checkCF(normalize-space())",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R047",
              "syntax": "CII",
              "source": "peppol",
              "flag": "warning",
              "text": "[PEPPOL-COMMON-R047]-Italian VAT Code (Partita Iva) must be stated in the correct format",
              "context": "ram:URIID[@schemeID = '0211'] | ram:ID[@schemeID = '0211'] | ram:GlobalID[@schemeID = '0211']",
              "test": "u:checkPIVAseIT(normalize-space())",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R049",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-COMMON-R049]-Swedish organization number MUST be stated in the correct format.",
              "context": "ram:URIID[@schemeID = '0007'] | ram:ID[@schemeID = '0007'] | ram:GlobalID[@schemeID = '0007']",
              "test": "string-length(normalize-space()) = 10 and string(number(normalize-space())) != 'NaN' and u:checkSEOrgnr(normalize-space())",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R050",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-COMMON-R050]-Australian Business Number (ABN) MUST be stated in the correct format.",
              "context": "ram:URIID[@schemeID = '0151'] | ram:ID[@schemeID = '0151'] | ram:GlobalID[@schemeID = '0151']",
              "test": "u:abn(normalize-space())",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R054",
              "syntax": "CII",
              "source": "peppol",
              "flag": "warning",
              "text": "[PEPPOL-COMMON-R054]-Dutch Chamber of Commerce (KVK) numbers (0106) MUST be stated in the correct format (12345678).",
              "context": "ram:URIID[@schemeID = '0106'] | ram:ID[@schemeID = '0106'] | ram:GlobalID[@schemeID = '0106']",
              "test": "matches(normalize-space(), '^[0-9]{8}$')",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R055",
              "syntax": "CII",
              "source": "peppol",
              "flag": "warning",
              "text": "[PEPPOL-COMMON-R055]-Dutch organization identification numbers (0190) MUST be stated in the correct format (12345678901234567890).",
              "context": "ram:URIID[@schemeID = '0190'] | ram:ID[@schemeID = '0190'] | ram:GlobalID[@schemeID = '0190']",
              "test": "matches(normalize-space(), '^[0-9]{20}$')",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R056-1",
              "syntax": "CII",
              "source": "peppol",
              "flag": "warning",
              "text": "[PEPPOL-COMMON-R056-1]-Dutch VAT numbers (9944) MUST be stated in the correct format (NL123456789B12).",
              "context": "ram:URIID[@schemeID = '9944'] | ram:ID[@schemeID = '9944'] | ram:GlobalID[@schemeID = '9944']",
              "test": "matches(normalize-space(), '^NL[0-9]{9}B[0-9]{2}$')",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R056-2",
              "syntax": "CII",
              "source": "peppol",
              "flag": "warning",
              "text": "[PEPPOL-COMMON-R056-2]-Dutch VAT numbers MUST have the format (NL123456789B12).",
              "context": "ram:SpecifiedTaxRegistration[ram:ID/@schemeID = 'VA'][starts-with(normalize-space(.), 'NL')]",
              "test": "matches(normalize-space(.), '^NL[0-9]{9}B[0-9]{2}$')",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R057",
              "syntax": "CII",
              "source": "peppol",
              "flag": "warning",
              "text": "[PEPPOL-COMMON-R057]-Dutch Chamber of Commerce Establishment numbers (0217) MUST be stated in the correct format (123456789012).",
              "context": "ram:URIID[@schemeID = '0217'] | ram:ID[@schemeID = '0217'] | ram:GlobalID[@schemeID = '0217']",
              "test": "matches(normalize-space(), '^[0-9]{12}$')",
              "phases": null
            },
            {
              "id": "NO-R-002",
              "syntax": "CII",
              "source": "peppol",
              "flag": "warning",
              "text": "[NO-R-002]-Most invoice issuers are required to append \"Foretaksregisteret\" to\n                their invoice. \"Dersom selger er aksjeselskap, allmennaksjeselskap eller filial av\n                utenlandsk selskap skal også ordet «Foretaksregisteret» fremgå av salgsdokumentet,\n                jf. foretaksregisterloven § 10-2.\"",
              "context": "ram:SellerTradeParty[$supplierCountry = 'NO']",
              "test": "ram:SpecifiedTaxRegistration/ram:ID[@schemeID = 'FC'][normalize-space(text()) = 'Foretaksregisteret']",
              "phases": null
            },
            {
              "id": "NO-R-001",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NO-R-001]-For Norwegian suppliers, a VAT number MUST be the country code prefix NO followed by a valid Norwegian organization number (nine numbers) followed by the letters MVA.",
              "context": "ram:SellerTradeParty[$supplierCountry = 'NO']",
              "test": "ram:SpecifiedTaxRegistration[ram:ID/@schemeID = 'VAT']/substring(ram:ID, 1, 2)='NO' and matches(ram:SpecifiedTaxRegistration[ram:ID/@schemeID = 'VAT']/substring(ram:ID,3) , '^[0-9]{9}MVA$')\n                and u:mod11(substring(ram:SpecifiedTaxRegistration[ram:ID/@schemeID = 'VAT']/ram:ID, 3, 9)) or not(ram:SpecifiedTaxRegistration[ram:ID/@schemeID = 'VAT']/substring(ram:ID, 1, 2)='NO')",
              "phases": null
            },
            {
              "id": "DK-R-002",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-002]-Danish suppliers MUST provide legal entity.",
              "context": "rsm:CrossIndustryInvoice[$DKSupplierCountry = 'DK']",
              "test": "(normalize-space(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedLegalOrganization/ram:ID/text()) != '')",
              "phases": null
            },
            {
              "id": "DK-R-004",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-004]-When specifying non-VAT Taxes for Danish customers, Danish suppliers MUST use the AllowanceChargeReasonCode=\"ZZZ\" and MUST be specified in AllowanceChargeReason; Either as the 4-digit Tax category or must include a #, but the # is not allowed as first and last character",
              "context": "rsm:CrossIndustryInvoice[$DKSupplierCountry = 'DK']",
              "test": "not((($DKCustomerCountry = 'DK') and (rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge/ram:ReasonCode = 'ZZZ'))\n                              and not ((string-length(normalize-space(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge/ram:Reason/text())) = 4\n                                       and number(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge/ram:Reason) >= 0\n                                       and number(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge/ram:Reason <= 9999)) or\n                                       (((rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge/ram:Reason\n                                                                          and contains(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge/ram:Reason, '#')\n                                                                          and not(starts-with(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge/ram:Reason, '#'))\n                                                                          and not(ends-with(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge/ram:Reason, '#'))))    )\n                                      )\n                              )",
              "phases": null
            },
            {
              "id": "DK-R-013",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-013]-For Danish Suppliers it is mandatory to use schemeID when GlobalID is used for SellerTradeParty or BuyerTradeParty",
              "context": "rsm:CrossIndustryInvoice[$DKSupplierCountry = 'DK']",
              "test": "not(($DKCustomerCountry = 'DK') and\n                                  ( ((boolean(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:GlobalID))\n                                     and (normalize-space(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:GlobalID/@schemeID) = ''))\n                                   or\n                                    ((boolean(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerTradeParty/ram:GlobalID))\n                                     and (normalize-space(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerTradeParty/ram:GlobalID/@schemeID) = ''))\n                                  )\n                              )",
              "phases": null
            },
            {
              "id": "DK-R-014",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-014]-For Danish Suppliers it is mandatory to specify schemeID as \"0184\" when SpecifiedLegalOrganization is used for SellerTradeParty",
              "context": "rsm:CrossIndustryInvoice[$DKSupplierCountry = 'DK']",
              "test": "not((boolean(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedLegalOrganization/ram:ID))\n                                     and (normalize-space(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedLegalOrganization/ram:ID/@schemeID) != '0184')\n                              )",
              "phases": null
            },
            {
              "id": "DK-R-016",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-016]-For Danish Suppliers, a Credit note cannot have a negative total (DuePayableAmount)",
              "context": "rsm:CrossIndustryInvoice[$DKSupplierCountry = 'DK']",
              "test": "not((($DKCustomerCountry = 'DK') and (normalize-space(rsm:ExchangedDocument/ram:TypeCode/text()) = '381'))\n                              and (number(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementHeaderMonetarySummation/ram:DuePayableAmount/text()) < 0)\n                              )",
              "phases": null
            },
            {
              "id": "DK-R-005",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-005]-For Danish suppliers the following Payment means type codes are allowed: 1, 10, 31, 42, 48, 49, 50, 58, 59, 93 and 97",
              "context": "rsm:CrossIndustryInvoice[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans",
              "test": "(contains(' 1 10 31 42 48 49 50 58 59 93 97 ', concat(' ', ram:TypeCode, ' ')))",
              "phases": null
            },
            {
              "id": "DK-R-006",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-006]-For Danish suppliers, bank account and registration account are mandatory if payment means is 31 or 42",
              "context": "rsm:CrossIndustryInvoice[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans",
              "test": "not( ((ram:TypeCode = '31') or (ram:TypeCode = '42'))\n                              and not((normalize-space(ram:PayeePartyCreditorFinancialAccount/ram:IBANID/text()) != '') and (normalize-space(ram:PayeeSpecifiedCreditorFinancialInstitution/ram:BICID/text()) != ''))\n                              )",
              "phases": null
            },
            {
              "id": "DK-R-007",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-007]-For Danish suppliers DirectDebitMandateID and CreditorReferenceID are mandatory when payment means is 49",
              "context": "rsm:CrossIndustryInvoice[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans",
              "test": "not((ram:TypeCode = '49')\n                              and not((normalize-space(../ram:CreditorReferenceID/text()) != '')\n                                      and (normalize-space(ram:SpecifiedTradePaymentTerms/ram:DirectDebitMandateID/text()) != ''))\n                              )",
              "phases": null
            },
            {
              "id": "DK-R-008",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-008]-For Danish Suppliers PaymentReference is mandatory and MUST start with 01#, 04# or 15# (kortartkode), and PayeePartyCreditorFinancialAccount/IBANID (Giro kontonummer) is mandatory and must be 7 characters long, when payment means equals 50 (Giro)",
              "context": "rsm:CrossIndustryInvoice[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans",
              "test": "not((ram:TypeCode = '50')\n                              and not(((substring(../ram:PaymentReference, 0, 4) = '01#')\n                                        or (substring(../ram:PaymentReference, 0, 4) = '04#')\n                                        or (substring(../ram:PaymentReference, 0, 4) = '15#'))\n                                      and (string-length(ram:PayeePartyCreditorFinancialAccount/ram:IBANID/text()) = 7)\n                                      )\n                              )",
              "phases": null
            },
            {
              "id": "DK-R-009",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-009]-For Danish Suppliers if the PaymentReference is prefixed with 04# or 015# the 16 digits instruction Id must be added to the PaymentReference eg. \"04#1234567890123456\" when Payment means equals 50 (Giro)",
              "context": "rsm:CrossIndustryInvoice[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans",
              "test": "not((ram:TypeCode = '50')\n                              and ((substring(../ram:PaymentReference, 0, 4) = '04#')\n                                    or (substring(../ram:PaymentReference, 0, 4)  = '15#'))\n                              and not(string-length(../ram:PaymentReference) = 19)\n                              )",
              "phases": null
            },
            {
              "id": "DK-R-010",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-010]-For Danish Suppliers using PaymentMeansCode 93, PaymentID is mandatory. The first three characters of the PaymentID MUST be 71#, 73# or 75# (kortartskode), and PayeeFinancialAccount/ID MUST be exactly 8 characters long.",
              "context": "rsm:CrossIndustryInvoice[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans",
              "test": "not((ram:TypeCode = '93')\n                              and not(((substring(../ram:PaymentReference, 0, 4) = '71#')\n                                        or (substring(../ram:PaymentReference, 0, 4) = '73#')\n                                        or (substring(../ram:PaymentReference, 0, 4) = '75#'))\n                                      and (string-length(ram:PayeePartyCreditorFinancialAccount/ram:IBANID/text()) = 8)\n                                      )\n                              )",
              "phases": null
            },
            {
              "id": "DK-R-011",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-011]-For Danish Suppliers if the PaymentReference is prefixed with 71# or 75# the 15-16 digits instruction Id must be added to the PaymentReference eg. \"71#1234567890123456\" when payment Method equals 93 (FIK)",
              "context": "rsm:CrossIndustryInvoice[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans",
              "test": "not((ram:TypeCode = '93')\n                              and ((substring(../ram:PaymentReference, 0, 4) = '71#')\n                                    or (substring(../ram:PaymentReference, 0, 4)  = '75#'))\n                              and not((string-length(../ram:PaymentReference) = 18)\n                                    or (string-length(../ram:PaymentReference) = 19))\n                              )",
              "phases": null
            },
            {
              "id": "DK-R-003",
              "syntax": "CII",
              "source": "peppol",
              "flag": "warning",
              "text": "[DK-R-003]-If ItemClassification is provided from Danish suppliers, UNSPSC version 19.05.01 or 26.08.01 should be used",
              "context": "rsm:CrossIndustryInvoice[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem",
              "test": "not((ram:SpecifiedTradeProduct/ram:DesignatedProductClassification/ram:ClassCode/@listID = 'TST')\n                              and not((ram:SpecifiedTradeProduct/ram:DesignatedProductClassification/ram:ClassCode/@listVersionID = '19.05.01')\n                                     or (ram:SpecifiedTradeProduct/ram:DesignatedProductClassification/ram:ClassCode/@listVersionID = '19.0501')\n                                     or (ram:SpecifiedTradeProduct/ram:DesignatedProductClassification/ram:ClassCode/@listVersionID = '26.08.01')\n                                     or (ram:SpecifiedTradeProduct/ram:DesignatedProductClassification/ram:ClassCode/@listVersionID = '26.0801')\n                               )\n                              )",
              "phases": null
            },
            {
              "id": "IT-R-001",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[IT-R-001]-BT-32 (Seller tax registration identifier) - For Italian suppliers BT-32 minimum length 11 and maximum length shall be 16.  Per i fornitori italiani il BT-32 deve avere una lunghezza tra 11 e 16 caratteri",
              "context": "ram:SellerTradeParty[$supplierCountry = 'IT']/ram:SpecifiedTaxRegistration",
              "test": " ram:ID[normalize-space(@schemeID) !='FC'] or matches(normalize-space(ram:ID[normalize-space(@schemeID) ='FC']) ,'^[A-Z0-9]{11,16}$') ",
              "phases": null
            },
            {
              "id": "IT-R-002",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[IT-R-002]-BT-35 (Seller address line 1) - Italian suppliers MUST provide the postal address line 1 - I fornitori italiani devono indicare l'indirizzo postale.",
              "context": "ram:SellerTradeParty[$supplierCountry = 'IT']",
              "test": "(ram:PostalTradeAddress/ram:LineOne)",
              "phases": null
            },
            {
              "id": "IT-R-003",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[IT-R-003]-BT-37 (Seller city) - Italian suppliers MUST provide the postal address city - I fornitori italiani devono indicare la città di residenza.",
              "context": "ram:SellerTradeParty[$supplierCountry = 'IT']",
              "test": "(ram:PostalTradeAddress/ram:CityName)",
              "phases": null
            },
            {
              "id": "IT-R-004",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[IT-R-004]-BT-38 (Seller post code) - Italian suppliers MUST provide the postal address post code - I fornitori italiani devono indicare il CAP di residenza.",
              "context": "ram:SellerTradeParty[$supplierCountry = 'IT']",
              "test": "(ram:PostalTradeAddress/ram:PostcodeCode)",
              "phases": null
            },
            {
              "id": "SE-R-001",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[SE-R-001]-For Swedish suppliers, Swedish VAT-numbers must consist of 14 characters.",
              "context": "rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty[ram:PostalTradeAddress/ram:CountryID = 'SE' and ram:SpecifiedTaxRegistration/substring(ram:ID[@schemeID = 'VAT'], 1, 2) = 'SE']",
              "test": "string-length(normalize-space(ram:SpecifiedTaxRegistration/ram:ID[@schemeID = 'VAT'])) = 14",
              "phases": null
            },
            {
              "id": "SE-R-002",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[SE-R-002]-For Swedish suppliers, the Swedish VAT-numbers must have the trailing 12 characters in numeric form",
              "context": "rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty[ram:PostalTradeAddress/ram:CountryID = 'SE' and ram:SpecifiedTaxRegistration/substring(ram:ID[@schemeID = 'VAT'], 1, 2) = 'SE']",
              "test": "string(number(substring(ram:SpecifiedTaxRegistration/ram:ID[@schemeID = 'VAT'], 3, 12))) != 'NaN'",
              "phases": null
            },
            {
              "id": "SE-R-003",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[SE-R-003]-Swedish organisation numbers should be numeric.",
              "context": "rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedLegalOrganization[../ram:PostalTradeAddress/ram:CountryID = 'SE' and ram:ID]",
              "test": "string(number(ram:ID)) != 'NaN'",
              "phases": null
            },
            {
              "id": "SE-R-004",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[SE-R-004]-Swedish organisation numbers consist of 10 characters.",
              "context": "rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedLegalOrganization[../ram:PostalTradeAddress/ram:CountryID = 'SE' and ram:ID]",
              "test": "string-length(normalize-space(ram:ID)) = 10",
              "phases": null
            },
            {
              "id": "SE-R-013",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[SE-R-013]-The last digit of a Swedish organization number must be valid according to the Luhn algorithm.",
              "context": "rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedLegalOrganization[../ram:PostalTradeAddress/ram:CountryID = 'SE' and ram:ID]",
              "test": "u:checkSEOrgnr(normalize-space(ram:ID))",
              "phases": null
            },
            {
              "id": "SE-R-005",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[SE-R-005]-For Swedish suppliers, when using Seller tax registration identifier, 'Godkänd för F-skatt' must be stated",
              "context": "rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty[ram:PostalTradeAddress/ram:CountryID = 'SE' and ram:SpecifiedLegalOrganization/ram:ID]/ram:SpecifiedTaxRegistration/ram:ID[@schemeID = 'FC']",
              "test": "normalize-space(upper-case(.)) = 'GODKÄND FÖR F-SKATT'",
              "phases": null
            },
            {
              "id": "SE-R-006",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[SE-R-006]-For Swedish suppliers, only standard VAT rate of 6, 12 or 25 are used",
              "context": "//ram:ApplicableTradeTax[/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty[ram:PostalTradeAddress/ram:CountryID = 'SE']/ram:SpecifiedTaxRegistration[substring(ram:ID[@schemeID = 'VAT'], 1, 2) = 'SE']] | //ram:CategoryTradeTax[/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty[ram:PostalTradeAddress/ram:CountryID = 'SE']/ram:SpecifiedTaxRegistration[substring(ram:ID[@schemeID = 'VAT'], 1, 2) = 'SE']]",
              "test": "number(ram:RateApplicablePercent) = 25 or number(ram:RateApplicablePercent) = 12 or number(ram:RateApplicablePercent) = 6",
              "phases": null
            },
            {
              "id": "SE-R-007",
              "syntax": "CII",
              "source": "peppol",
              "flag": "warning",
              "text": "[SE-R-007]-For Swedish suppliers using Plusgiro, the Account ID must be numeric",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction[ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty[ram:PostalTradeAddress/ram:CountryID = 'SE']]/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans[normalize-space(ram:TypeCode) = '30' and normalize-space(ram:PayeeSpecifiedCreditorFinancialInstitution/ram:BICID) = 'SE:PLUSGIRO']/ram:PayeePartyCreditorFinancialAccount/ram:ProprietaryID",
              "test": "string(number(normalize-space(.))) != 'NaN'",
              "phases": null
            },
            {
              "id": "SE-R-010",
              "syntax": "CII",
              "source": "peppol",
              "flag": "warning",
              "text": "[SE-R-010]-For Swedish suppliers using Plusgiro, the Account ID must have 2-8 characters",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction[ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty[ram:PostalTradeAddress/ram:CountryID = 'SE']]/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans[normalize-space(ram:TypeCode) = '30' and normalize-space(ram:PayeeSpecifiedCreditorFinancialInstitution/ram:BICID) = 'SE:PLUSGIRO']/ram:PayeePartyCreditorFinancialAccount/ram:ProprietaryID",
              "test": "string-length(normalize-space(.)) >= 2 and string-length(normalize-space(.)) <= 8",
              "phases": null
            },
            {
              "id": "SE-R-008",
              "syntax": "CII",
              "source": "peppol",
              "flag": "warning",
              "text": "[SE-R-008]-For Swedish suppliers using Bankgiro, the Account ID must be numeric",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction[ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty[ram:PostalTradeAddress/ram:CountryID = 'SE']]/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans[normalize-space(ram:TypeCode) = '30' and normalize-space(ram:PayeeSpecifiedCreditorFinancialInstitution/ram:BICID) = 'SE:BANKGIRO']/ram:PayeePartyCreditorFinancialAccount/ram:ProprietaryID",
              "test": "string(number(normalize-space(.))) != 'NaN'",
              "phases": null
            },
            {
              "id": "SE-R-009",
              "syntax": "CII",
              "source": "peppol",
              "flag": "warning",
              "text": "[SE-R-009]-For Swedish suppliers using Bankgiro, the Account ID must have 7-8 characters",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction[ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty[ram:PostalTradeAddress/ram:CountryID = 'SE']]/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans[normalize-space(ram:TypeCode) = '30' and normalize-space(ram:PayeeSpecifiedCreditorFinancialInstitution/ram:BICID) = 'SE:BANKGIRO']/ram:PayeePartyCreditorFinancialAccount/ram:ProprietaryID",
              "test": "string-length(normalize-space(.)) = 7 or string-length(normalize-space(.)) = 8",
              "phases": null
            },
            {
              "id": "SE-R-011",
              "syntax": "CII",
              "source": "peppol",
              "flag": "warning",
              "text": "[SE-R-011]-For Swedish suppliers using Swedish Bankgiro or Plusgiro, the proper way to indicate this is to use Code 30 for PaymentMeans and FinancialInstitutionBranch ID with code SE:BANKGIRO or SE:PLUSGIRO",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction[ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty[ram:PostalTradeAddress/ram:CountryID = 'SE']]/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans[normalize-space(ram:TypeCode) = '50' or normalize-space(ram:TypeCode) = '56']",
              "test": "false()",
              "phases": null
            },
            {
              "id": "SE-R-012",
              "syntax": "CII",
              "source": "peppol",
              "flag": "warning",
              "text": "[SE-R-012]-For domestic transactions between Swedish trading partners, credit transfer should be indicated by PaymentMeansCode=”30”",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction[ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty[ram:PostalTradeAddress/ram:CountryID = 'SE'] and ram:ApplicableHeaderTradeAgreement/ram:BuyerTradeParty[ram:PostalTradeAddress/ram:CountryID = 'SE']]/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans[normalize-space(ram:TypeCode) = '31']",
              "test": "false()",
              "phases": null
            },
            {
              "id": "NL-R-001",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NL-R-001]-For suppliers in the Netherlands, if the document is a creditnote, the document MUST contain an invoice reference (ram:ApplicableHeaderTradeSettlement/ram:InvoiceReferencedDocument/ram:IssuerAssignedID)",
              "context": "/rsm:CrossIndustryInvoice/rsm:ExchangedDocument[some $code in tokenize('81 83 381 396 532', '\\s') satisfies normalize-space(ram:TypeCode) = $code][$supplierCountryIsNL]",
              "test": "//ram:ApplicableHeaderTradeSettlement/ram:InvoiceReferencedDocument/ram:IssuerAssignedID",
              "phases": null
            },
            {
              "id": "NL-R-002",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NL-R-002]-For suppliers in the Netherlands the supplier's address (ram:SellerTradeParty/ram:PostalTradeAddress) MUST contain street name (ram:LineOne), city (ram:CityName) and post code (ram:PostcodeCode)",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:PostalTradeAddress[$supplierCountryIsNL]",
              "test": "ram:LineOne and ram:CityName and ram:PostcodeCode",
              "phases": null
            },
            {
              "id": "NL-R-003",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NL-R-003]-For suppliers in the Netherlands, the legal entity identifier MUST be either a KVK or OIN number (schemeID 0106 or 0190)",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedLegalOrganization/ram:ID[$supplierCountryIsNL]",
              "test": "(contains(concat(' ', string-join(@schemeID, ' '), ' '), ' 0106 ') or contains(concat(' ', string-join(@schemeID, ' '), ' '), ' 0190 ')) and (normalize-space(.) != '')",
              "phases": null
            },
            {
              "id": "NL-R-004",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NL-R-004]-For suppliers in the Netherlands, if the customer is in the Netherlands, the customer address (ram:BuyerTradeParty/ram:PostalTradeAddress) MUST contain street name (ram:LineOne), city (ram:CityName) and post code (ram:PostcodeCode)",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerTradeParty/ram:PostalTradeAddress[$supplierCountryIsNL and $customerCountryIsNL]",
              "test": "ram:LineOne and ram:CityName and ram:PostcodeCode",
              "phases": null
            },
            {
              "id": "NL-R-005",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NL-R-005]-For suppliers in the Netherlands, if the customer is in the Netherlands, the customer's legal entity identifier MUST be either a KVK or OIN number (schemeID 0106 or 0190)",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerTradeParty/ram:SpecifiedLegalOrganization/ram:ID[$supplierCountryIsNL and $customerCountryIsNL]",
              "test": "\n          (contains(concat(' ', string-join(@schemeID, ' '), ' '), ' 0106 ')\n           or\n           contains(concat(' ', string-join(@schemeID, ' '), ' '), ' 0190 ')\n          ) and (normalize-space(.) != '')\n      ",
              "phases": null
            },
            {
              "id": "NL-R-006",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NL-R-006]-For suppliers in the Netherlands, if the fiscal representative is in the Netherlands, the representative's address (ram:SellerTaxRepresentativeTradeParty/ram:PostalTradeAddress) MUST contain street name (ram:LineOne), city (ram:CityName) and post code (ram:PostcodeCode)",
              "context": "rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTaxRepresentativeTradeParty/ram:PostalTradeAddress[$supplierCountryIsNL and $taxRepresentativeCountryIsNL]",
              "test": "ram:LineOne and ram:CityName and ram:PostcodeCode",
              "phases": null
            },
            {
              "id": "NL-R-007",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NL-R-007]-For suppliers in the Netherlands, the supplier MUST provide a means of payment (ram:SpecifiedTradeSettlementPaymentMeans) if the payment is from customer to supplier",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementHeaderMonetarySummation[$supplierCountryIsNL]",
              "test": "(normalize-space(/rsm:CrossIndustryInvoice/rsm:ExchangedDocument/ram:TypeCode/text()) != '381' and\n                                   xs:decimal(ram:DuePayableAmount) <= 0.0) or\n                                  (normalize-space(/rsm:CrossIndustryInvoice/rsm:ExchangedDocument/ram:TypeCode/text()) = '381' and\n                                   xs:decimal(ram:DuePayableAmount) >= 0.0) or\n                                  (/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans)",
              "phases": null
            },
            {
              "id": "NL-R-008",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NL-R-008]-For suppliers in the Netherlands, if the customer is in the Netherlands, the payment means code (ram:SpecifiedTradeSettlementPaymentMeans/ram:TypeCode) MUST be one of 30, 48, 49, 57, 58 or 59",
              "context": "/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans[$supplierCountryIsNL and $customerCountryIsNL]",
              "test": "normalize-space(ram:TypeCode) = '30' or\n                normalize-space(ram:TypeCode) = '48' or\n                normalize-space(ram:TypeCode) = '49' or\n                normalize-space(ram:TypeCode) = '57' or\n                normalize-space(ram:TypeCode) = '58' or\n                normalize-space(ram:TypeCode) = '59'",
              "phases": null
            },
            {
              "id": "NL-R-009",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NL-R-009]-For suppliers in the Netherlands, if an order line reference (ram:BuyerOrderReferencedDocument/ram:LineID) is used, there must be an order reference on the document level (rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerOrderReferencedDocument/ram:IssuerAssignedID)",
              "context": "rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeAgreement/ram:BuyerOrderReferencedDocument/ram:LineID[$supplierCountryIsNL]",
              "test": "exists(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerOrderReferencedDocument/ram:IssuerAssignedID)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-CL001",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-CL001]-Mime code must be according to subset of IANA code list.",
              "context": "ram:AttachmentBinaryObject[@mimeCode]",
              "test": "\n                    some $code in $MIMECODE\n                        satisfies @mimeCode = $code",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-CL002",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-CL002]-Reason code MUST be according to subset of UNCL 5189 D.16B.",
              "context": "ram:SpecifiedTradeAllowanceCharge[normalize-space(ram:ChargeIndicator/udt:Indicator) = 'false']/ram:ReasonCode",
              "test": "\n                    some $code in $UNCL5189\n                        satisfies normalize-space(text()) = $code",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-CL003",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-CL003]-Reason code MUST be according to UNCL 7161 D.16B.",
              "context": "ram:SpecifiedTradeAllowanceCharge[normalize-space(ram:ChargeIndicator/udt:Indicator) = 'true']/ram:ReasonCode",
              "test": "\n                    some $code in $UNCL7161\n                        satisfies normalize-space(text()) = $code",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-CL007",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-CL007]-Currency code must be according to ISO 4217:2005",
              "context": "ram:TaxTotalAmount[@currencyID]",
              "test": "\n                    some $code in $ISO4217\n                        satisfies @currencyID = $code",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-P0100",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-P0100]-Invoice type code MUST be set according to the profile.",
              "context": "ram:ExchangedDocument/ram:TypeCode",
              "test": "\n                    not($profile = ('01','02')) or (some $code in tokenize('71 102 218 219 326 331 382 553 817 870 875 876 877 380 383 384 386 388 393 82 80 84 395 575 623 780 381 396 81 83 532', '\\s')\n                        satisfies normalize-space(text()) = $code)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-F001",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-F001]-A date MUST be formatted YYYYMMDD.",
              "context": "udt:DateTimeString",
              "test": "normalize-space(@format) = '102' and string-length(text()) = 8 and matches(normalize-space(text()), '20[0-9]{6}')",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-CL008",
              "syntax": "CII",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-CL008]-Electronic address identifier scheme must be from the codelist \"Electronic Address Identifier Scheme\"",
              "context": "ram:BuyerTradeParty/ram:URIUniversalCommunication/ram:URIID | ram:SellerTradeParty/ram:URIUniversalCommunication/ram:URIID",
              "test": "\n                some $code in $eaid\n                satisfies @schemeID = $code",
              "phases": null
            }
          ]
        },
        "ubl": {
          "assertions": 1144,
          "fatal": 420,
          "warning": 724,
          "information": 0,
          "ids": 1144,
          "added": [
            {
              "id": "BR-AF-01",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-01]-An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"IGIC\" shall contain in the VAT breakdown (BG-23) at least one VAT category code (BT-118) equal with \"IGIC\".",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "((count(//cac:AllowanceCharge/cac:TaxCategory[normalize-space(cbc:ID) = 'L'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']) + count(//cac:ClassifiedTaxCategory[normalize-space(cbc:ID) = 'L'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT'])) > 0 and count(cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[cbc:ID = 'L']) > 0) or ((count(//cac:AllowanceCharge/cac:TaxCategory[normalize-space(cbc:ID) = 'L'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']) + count(//cac:ClassifiedTaxCategory[normalize-space(cbc:ID) = 'L'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT'])) = 0 and count(cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'L'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']) = 0)",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "BR-AF-02",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-02]-An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"IGIC\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "(exists(//cac:ClassifiedTaxCategory[normalize-space(cbc:ID) = 'L'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']) and (exists(//cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID) or exists(//cac:TaxRepresentativeParty/cac:PartyTaxScheme[cac:TaxScheme/(normalize-space(upper-case(cbc:ID)) = 'VAT')]/cbc:CompanyID))) or not(exists(//cac:ClassifiedTaxCategory[normalize-space(cbc:ID) = 'L'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']))",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "BR-AF-03",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-03]-An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"IGIC\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "(exists(//cac:AllowanceCharge[cbc:ChargeIndicator=false()]/cac:TaxCategory[normalize-space(cbc:ID)='L'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']) and (exists(//cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID) or exists(//cac:TaxRepresentativeParty/cac:PartyTaxScheme[cac:TaxScheme/(normalize-space(upper-case(cbc:ID)) = 'VAT')]/cbc:CompanyID))) or not(exists(//cac:AllowanceCharge[cbc:ChargeIndicator=false()]/cac:TaxCategory[normalize-space(cbc:ID)='L'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']))",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "BR-AF-04",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-04]-An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"IGIC\" shall contain the Seller VAT Identifier (BT-31), the Seller Tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "(exists(//cac:AllowanceCharge[cbc:ChargeIndicator=true()]/cac:TaxCategory[normalize-space(cbc:ID)='L'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']) and (exists(//cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID) or exists(//cac:TaxRepresentativeParty/cac:PartyTaxScheme[cac:TaxScheme/(normalize-space(upper-case(cbc:ID)) = 'VAT')]/cbc:CompanyID))) or not(exists(//cac:AllowanceCharge[cbc:ChargeIndicator=true()]/cac:TaxCategory[cbc:ID='L'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']))",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "BR-AG-01",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-01]-An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"IPSI\" shall contain in the VAT breakdown (BG-23) at least one VAT category code (BT-118) equal with \"IPSI\".",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "((count(//cac:AllowanceCharge/cac:TaxCategory[normalize-space(cbc:ID) = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']) + count(//cac:ClassifiedTaxCategory[normalize-space(cbc:ID) = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT'])) > 0 and count(cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[cbc:ID = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']) > 0) or ((count(//cac:AllowanceCharge/cac:TaxCategory[normalize-space(cbc:ID) = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']) + count(//cac:ClassifiedTaxCategory[normalize-space(cbc:ID) = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT'])) = 0 and count(cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']) = 0)",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "BR-AG-02",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-02]-An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"IPSI\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "(exists(//cac:ClassifiedTaxCategory[normalize-space(cbc:ID) = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']) and (exists(//cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID) or exists(//cac:TaxRepresentativeParty/cac:PartyTaxScheme[cac:TaxScheme/(normalize-space(upper-case(cbc:ID)) = 'VAT')]/cbc:CompanyID))) or not(exists(//cac:ClassifiedTaxCategory[normalize-space(cbc:ID) = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']))",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "BR-AG-03",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-03]-An Invoice that contains a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"IPSI\" shall contain the Seller VAT Identifier (BT-31), the Seller Tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "(exists(//cac:AllowanceCharge[cbc:ChargeIndicator=false()]/cac:TaxCategory[normalize-space(cbc:ID)='M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']) and (exists(//cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID) or exists(//cac:TaxRepresentativeParty/cac:PartyTaxScheme[cac:TaxScheme/(normalize-space(upper-case(cbc:ID)) = 'VAT')]/cbc:CompanyID))) or not(exists(//cac:AllowanceCharge[cbc:ChargeIndicator=false()]/cac:TaxCategory[normalize-space(cbc:ID)='M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']))",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "BR-AG-04",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-04]-An Invoice that contains a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"IPSI\" shall contain the Seller VAT Identifier (BT-31), the Seller Tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63).",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "(exists(//cac:AllowanceCharge[cbc:ChargeIndicator=true()]/cac:TaxCategory[normalize-space(cbc:ID)='M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']) and (exists(//cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID) or exists(//cac:TaxRepresentativeParty/cac:PartyTaxScheme[cac:TaxScheme/(normalize-space(upper-case(cbc:ID)) = 'VAT')]/cbc:CompanyID))) or not(exists(//cac:AllowanceCharge[cbc:ChargeIndicator=true()]/cac:TaxCategory[normalize-space(cbc:ID)='M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']))",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "BR-AF-08",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-08]-For each different value of VAT category rate (BT-119) where the VAT category code (BT-118) is \"IGIC\", the VAT category taxable amount (BT-116) in a VAT breakdown (BG-23) shall equal the sum of Invoice line net amounts (BT-131) plus the sum of document level charge amounts (BT-99) minus the sum of document level allowance amounts (BT-92) where the VAT category code (BT-151, BT-102, BT-95) is \"IGIC\" and the VAT rate (BT-152, BT-103, BT-96) equals the VAT category rate (BT-119).",
              "context": "/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'L'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']",
              "test": "every $rate in xs:decimal(cbc:Percent) satisfies ((exists(//cac:InvoiceLine) and ((../xs:decimal(cbc:TaxableAmount - 1) < (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='L'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) + sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='L'][cac:TaxCategory/xs:decimal(cbc:Percent) = $rate]/xs:decimal(cbc:Amount)) - sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='L'][cac:TaxCategory/xs:decimal(cbc:Percent) = $rate]/xs:decimal(cbc:Amount)))) and (../xs:decimal(cbc:TaxableAmount + 1) > (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='L'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) + sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='L'][cac:TaxCategory/xs:decimal(cbc:Percent) = $rate]/xs:decimal(cbc:Amount)) - sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='L'][cac:TaxCategory/xs:decimal(cbc:Percent) = $rate]/xs:decimal(cbc:Amount)))))) or (exists(//cac:CreditNoteLine) and ((../xs:decimal(cbc:TaxableAmount - 1) < (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='L'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) + sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='L'][cac:TaxCategory/xs:decimal(cbc:Percent) = $rate]/xs:decimal(cbc:Amount)) - sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='L'][cac:TaxCategory/xs:decimal(cbc:Percent) = $rate]/xs:decimal(cbc:Amount)))) and (../xs:decimal(cbc:TaxableAmount + 1) > (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='L'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) + sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='L'][cac:TaxCategory/xs:decimal(cbc:Percent) = $rate]/xs:decimal(cbc:Amount)) - sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='L'][cac:TaxCategory/xs:decimal(cbc:Percent) = $rate]/xs:decimal(cbc:Amount)))))))",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "BR-AF-09",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-09]-The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where VAT category code (BT-118) is \"IGIC\" shall equal the VAT category taxable amount (BT-116) multiplied by the VAT category rate (BT-119).",
              "context": "/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'L'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']",
              "test": "(abs(xs:decimal(../cbc:TaxAmount)) - 1 <  round((abs(xs:decimal(../cbc:TaxableAmount)) * (xs:decimal(cbc:Percent) div 100)) * 10 * 10) div 100 ) and (abs(xs:decimal(../cbc:TaxAmount)) + 1 >  round((abs(xs:decimal(../cbc:TaxableAmount)) * (xs:decimal(cbc:Percent) div 100)) * 10 * 10) div 100 )",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "BR-AF-10",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-10]-A VAT breakdown (BG-23) with VAT Category code (BT-118) \"IGIC\" shall not have a VAT exemption reason code (BT-121) or VAT exemption reason text (BT-120).",
              "context": "/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'L'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']",
              "test": "not(cbc:TaxExemptionReason) and not(cbc:TaxExemptionReasonCode)",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "BR-AF-06",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-06]-In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"IGIC\" the Document level allowance VAT rate (BT-96) shall be 0 (zero) or greater than zero.",
              "context": "cac:AllowanceCharge[cbc:ChargeIndicator=false()]/cac:TaxCategory[normalize-space(cbc:ID)='L'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']",
              "test": "(cbc:Percent) >= 0",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "BR-AF-07",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-07]-In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"IGIC\" the Document level charge VAT rate (BT-103) shall be 0 (zero) or greater than zero.",
              "context": "cac:AllowanceCharge[cbc:ChargeIndicator=true()]/cac:TaxCategory[normalize-space(cbc:ID)='L'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']",
              "test": "(cbc:Percent) >= 0",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "BR-AF-05",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AF-05]-In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"IGIC\" the invoiced item VAT rate (BT-152) shall be 0 (zero) or greater than zero.",
              "context": "cac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory[normalize-space(cbc:ID) = 'L'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']| cac:CreditNoteLine/cac:Item/cac:ClassifiedTaxCategory[normalize-space(cbc:ID) = 'L'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']",
              "test": "(cbc:Percent) >= 0",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "BR-AG-08",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-08]-For each different value of VAT category rate (BT-119) where the VAT category code (BT-118) is \"IPSI\", the VAT category taxable amount (BT-116) in a VAT breakdown (BG-23) shall equal the sum of Invoice line net amounts (BT-131) plus the sum of document level charge amounts (BT-99) minus the sum of document level allowance amounts (BT-92) where the VAT category code (BT-151, BT-102, BT-95) is \"IPSI\" and the VAT rate (BT-152, BT-103, BT-96) equals the VAT category rate (BT-119).",
              "context": "/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']",
              "test": "every $rate in xs:decimal(cbc:Percent) satisfies ((exists(//cac:InvoiceLine) and ((../xs:decimal(cbc:TaxableAmount - 1) < (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='M'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) + sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='M'][cac:TaxCategory/xs:decimal(cbc:Percent) = $rate]/xs:decimal(cbc:Amount)) - sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='M'][cac:TaxCategory/xs:decimal(cbc:Percent) = $rate]/xs:decimal(cbc:Amount)))) and (../xs:decimal(cbc:TaxableAmount + 1) > (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='M'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) + sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='M'][cac:TaxCategory/xs:decimal(cbc:Percent) = $rate]/xs:decimal(cbc:Amount)) - sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='M'][cac:TaxCategory/xs:decimal(cbc:Percent) = $rate]/xs:decimal(cbc:Amount)))))) or (exists(//cac:CreditNoteLine) and ((../xs:decimal(cbc:TaxableAmount - 1) < (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='M'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) + sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='M'][cac:TaxCategory/xs:decimal(cbc:Percent) = $rate]/xs:decimal(cbc:Amount)) - sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='M'][cac:TaxCategory/xs:decimal(cbc:Percent) = $rate]/xs:decimal(cbc:Amount)))) and (../xs:decimal(cbc:TaxableAmount + 1) > (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='M'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) + sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='M'][cac:TaxCategory/xs:decimal(cbc:Percent) = $rate]/xs:decimal(cbc:Amount)) - sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='M'][cac:TaxCategory/xs:decimal(cbc:Percent) = $rate]/xs:decimal(cbc:Amount)))))))",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "BR-AG-09",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-09]-The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where VAT category code (BT-118) is \"IPSI\" shall equal the VAT category taxable amount (BT-116) multiplied by the VAT category rate (BT-119).",
              "context": "/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']",
              "test": "(abs(xs:decimal(../cbc:TaxAmount)) - 1 <  round((abs(xs:decimal(../cbc:TaxableAmount)) * (xs:decimal(cbc:Percent) div 100)) * 10 * 10) div 100 ) and (abs(xs:decimal(../cbc:TaxAmount)) + 1 >  round((abs(xs:decimal(../cbc:TaxableAmount)) * (xs:decimal(cbc:Percent) div 100)) * 10 * 10) div 100 )",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "BR-AG-10",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-10]-A VAT breakdown (BG-23) with VAT Category code (BT-118) \"IPSI\" shall not have a VAT exemption reason code (BT-121) or VAT exemption reason text (BT-120).",
              "context": "/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']",
              "test": "not(cbc:TaxExemptionReason) and not(cbc:TaxExemptionReasonCode)",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "BR-AG-06",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-06]-In a Document level allowance (BG-20) where the Document level allowance VAT category code (BT-95) is \"IPSI\" the Document level allowance VAT rate (BT-96) shall be 0 (zero) or greater than zero.",
              "context": "cac:AllowanceCharge[cbc:ChargeIndicator=false()]/cac:TaxCategory[normalize-space(cbc:ID)='M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']",
              "test": "(cbc:Percent) >= 0",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "BR-AG-07",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-07]-In a Document level charge (BG-21) where the Document level charge VAT category code (BT-102) is \"IPSI\" the Document level charge VAT rate (BT-103) shall be 0 (zero) or greater than zero.",
              "context": "cac:AllowanceCharge[cbc:ChargeIndicator=true()]/cac:TaxCategory[normalize-space(cbc:ID)='M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']",
              "test": "(cbc:Percent) >= 0",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "BR-AG-05",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "fatal",
              "text": "[BR-AG-05]-In an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"IPSI\" the Invoiced item VAT rate (BT-152) shall be 0 (zero) or greater than zero.",
              "context": "cac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory[normalize-space(cbc:ID) = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']| cac:CreditNoteLine/cac:Item/cac:ClassifiedTaxCategory[normalize-space(cbc:ID) = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']",
              "test": "(cbc:Percent) >= 0",
              "phases": [
                "EN16931model_phase"
              ]
            },
            {
              "id": "UBL-CR-674",
              "syntax": "UBL",
              "source": "peppol-cen",
              "flag": "warning",
              "text": "[UBL-CR-674]-A UBL invoice should not include the PrimaryAccountNumber schemeID",
              "context": "/ubl:Invoice | /cn:CreditNote",
              "test": "not(//cbc:PrimaryAccountNumberID/@schemeID)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R008",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R008]-Document MUST not contain empty elements.",
              "context": "//*[not(*) and not(normalize-space())]",
              "test": "false()",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R080",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R080]-Only one project reference is allowed on document level",
              "context": "ubl-creditnote:CreditNote",
              "test": "(count(cac:AdditionalDocumentReference[cbc:DocumentTypeCode='50']) <= 1)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R001",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R001]-Business process MUST be provided.",
              "context": "ubl-creditnote:CreditNote | ubl-invoice:Invoice",
              "test": "cbc:ProfileID",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R007",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R007]-Business process MUST have an approved identifier.",
              "context": "ubl-creditnote:CreditNote | ubl-invoice:Invoice",
              "test": "$profile != 'Unknown'",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R002",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R002]-No more than one note is allowed on document level, unless both the buyer and seller are German organizations.",
              "context": "ubl-creditnote:CreditNote | ubl-invoice:Invoice",
              "test": "count(cbc:Note) <= 1 or ($supplierCountryIsDE and $customerCountryIsDE)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R003",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R003]-A buyer reference or purchase order reference MUST be provided.",
              "context": "ubl-creditnote:CreditNote | ubl-invoice:Invoice",
              "test": "cbc:BuyerReference or cac:OrderReference/cbc:ID",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R004",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R004]-Specification identifier MUST begin with the value 'urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0' and follow the format rules for the identifier.",
              "context": "ubl-creditnote:CreditNote | ubl-invoice:Invoice",
              "test": "starts-with(normalize-space(cbc:CustomizationID/text()), 'urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0') and not(contains(normalize-space(cbc:CustomizationID/text()), '::'))",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R053",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R053]-Only one tax total with tax subtotals MUST be provided.",
              "context": "ubl-creditnote:CreditNote | ubl-invoice:Invoice",
              "test": "count(cac:TaxTotal[cac:TaxSubtotal]) = 1",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R054",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R054]-Only one tax total without tax subtotals MUST be provided when tax currency code is provided.",
              "context": "ubl-creditnote:CreditNote | ubl-invoice:Invoice",
              "test": "count(cac:TaxTotal[not(cac:TaxSubtotal)]) = (if (cbc:TaxCurrencyCode) then 1 else 0)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R055",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R055]-Invoice total VAT amount and Invoice total VAT amount in accounting currency MUST have the same operational sign",
              "context": "ubl-creditnote:CreditNote | ubl-invoice:Invoice",
              "test": "not(cbc:TaxCurrencyCode) or (cac:TaxTotal/cbc:TaxAmount[@currencyID=normalize-space(../../cbc:TaxCurrencyCode)] <= 0 and cac:TaxTotal/cbc:TaxAmount[@currencyID=normalize-space(../../cbc:DocumentCurrencyCode)] <= 0) or (cac:TaxTotal/cbc:TaxAmount[@currencyID=normalize-space(../../cbc:TaxCurrencyCode)] >= 0 and cac:TaxTotal/cbc:TaxAmount[@currencyID=normalize-space(../../cbc:DocumentCurrencyCode)] >= 0) ",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R005",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R005]-VAT accounting currency code MUST be different from invoice currency code when provided.",
              "context": "cbc:TaxCurrencyCode",
              "test": "not(normalize-space(text()) = normalize-space(../cbc:DocumentCurrencyCode/text()))",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R010",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R010]-Buyer electronic address MUST be provided",
              "context": "cac:AccountingCustomerParty/cac:Party",
              "test": "cbc:EndpointID",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R020",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R020]-Seller electronic address MUST be provided",
              "context": "cac:AccountingSupplierParty/cac:Party",
              "test": "cbc:EndpointID",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R041",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R041]-Allowance/charge base amount MUST be provided when allowance/charge percentage is provided.",
              "context": "ubl-invoice:Invoice/cac:AllowanceCharge[cbc:MultiplierFactorNumeric and not(cbc:BaseAmount)] | ubl-invoice:Invoice/cac:InvoiceLine/cac:AllowanceCharge[cbc:MultiplierFactorNumeric and not(cbc:BaseAmount)] | ubl-creditnote:CreditNote/cac:AllowanceCharge[cbc:MultiplierFactorNumeric and not(cbc:BaseAmount)] | ubl-creditnote:CreditNote/cac:CreditNoteLine/cac:AllowanceCharge[cbc:MultiplierFactorNumeric and not(cbc:BaseAmount)]",
              "test": "false()",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R042",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R042]-Allowance/charge percentage MUST be provided when allowance/charge base amount is provided.",
              "context": "ubl-invoice:Invoice/cac:AllowanceCharge[not(cbc:MultiplierFactorNumeric) and cbc:BaseAmount] | ubl-invoice:Invoice/cac:InvoiceLine/cac:AllowanceCharge[not(cbc:MultiplierFactorNumeric) and cbc:BaseAmount] | ubl-creditnote:CreditNote/cac:AllowanceCharge[not(cbc:MultiplierFactorNumeric) and cbc:BaseAmount] | ubl-creditnote:CreditNote/cac:CreditNoteLine/cac:AllowanceCharge[not(cbc:MultiplierFactorNumeric) and cbc:BaseAmount]",
              "test": "false()",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R040",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R040]-Allowance/charge amount must equal base amount * percentage/100 if base amount and percentage exists",
              "context": "ubl-invoice:Invoice/cac:AllowanceCharge | ubl-invoice:Invoice/cac:InvoiceLine/cac:AllowanceCharge | ubl-creditnote:CreditNote/cac:AllowanceCharge | ubl-creditnote:CreditNote/cac:CreditNoteLine/cac:AllowanceCharge",
              "test": "\n          not(cbc:MultiplierFactorNumeric and cbc:BaseAmount) or u:slack(if (cbc:Amount) then\n            cbc:Amount\n          else\n            0, (xs:decimal(cbc:BaseAmount) * xs:decimal(cbc:MultiplierFactorNumeric)) div 100, 0.02)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R043",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R043]-Allowance/charge ChargeIndicator value MUST equal 'true' or 'false'",
              "context": "ubl-invoice:Invoice/cac:AllowanceCharge | ubl-invoice:Invoice/cac:InvoiceLine/cac:AllowanceCharge | ubl-creditnote:CreditNote/cac:AllowanceCharge | ubl-creditnote:CreditNote/cac:CreditNoteLine/cac:AllowanceCharge",
              "test": "normalize-space(cbc:ChargeIndicator/text()) = 'true' or normalize-space(cbc:ChargeIndicator/text()) = 'false'",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R061",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R061]-Mandate reference MUST be provided for direct debit.",
              "context": "\n        cac:PaymentMeans[some $code in tokenize('49 59', '\\s')\n          satisfies normalize-space(cbc:PaymentMeansCode) = $code]",
              "test": "cac:PaymentMandate/cbc:ID",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R051",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R051]-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).",
              "context": "cbc:Amount | cbc:BaseAmount | cbc:PriceAmount | cac:TaxTotal[cac:TaxSubtotal]/cbc:TaxAmount | cac:TaxSubtotal/cbc:TaxAmount | cbc:TaxableAmount | cbc:LineExtensionAmount | cbc:TaxExclusiveAmount | cbc:TaxInclusiveAmount | cbc:AllowanceTotalAmount | cbc:ChargeTotalAmount | cbc:PrepaidAmount | cbc:PayableRoundingAmount | cbc:PayableAmount",
              "test": "@currencyID = $documentCurrencyCode",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R110",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R110]-Start date of line period MUST be within invoice period.",
              "context": "ubl-invoice:Invoice[cac:InvoicePeriod/cbc:StartDate]/cac:InvoiceLine/cac:InvoicePeriod/cbc:StartDate | ubl-creditnote:CreditNote[cac:InvoicePeriod/cbc:StartDate]/cac:CreditNoteLine/cac:InvoicePeriod/cbc:StartDate",
              "test": "xs:date(text()) >= xs:date(../../../cac:InvoicePeriod/cbc:StartDate)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R111",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R111]-End date of line period MUST be within invoice period.",
              "context": "ubl-invoice:Invoice[cac:InvoicePeriod/cbc:EndDate]/cac:InvoiceLine/cac:InvoicePeriod/cbc:EndDate | ubl-creditnote:CreditNote[cac:InvoicePeriod/cbc:EndDate]/cac:CreditNoteLine/cac:InvoicePeriod/cbc:EndDate",
              "test": "xs:date(text()) <= xs:date(../../../cac:InvoicePeriod/cbc:EndDate)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R120",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R120]-Invoice line net amount MUST equal (Invoiced quantity * (Item net price/item price base quantity) + Sum of invoice line charge amount - sum of invoice line allowance amount",
              "context": "cac:InvoiceLine | cac:CreditNoteLine",
              "test": "u:slack($lineExtensionAmount, ($quantity * ($priceAmount div $baseQuantity)) + $chargesTotal - $allowancesTotal, 0.02)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R121",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R121]-Base quantity MUST be a positive number above zero.",
              "context": "cac:InvoiceLine | cac:CreditNoteLine",
              "test": "not(cac:Price/cbc:BaseQuantity) or xs:decimal(cac:Price/cbc:BaseQuantity) > 0",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R100",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R100]-Only one invoiced object is allowed pr line",
              "context": "cac:InvoiceLine | cac:CreditNoteLine",
              "test": "(count(cac:DocumentReference) <= 1)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R101",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R101]-Element Document reference can only be used for Invoice line object",
              "context": "cac:InvoiceLine | cac:CreditNoteLine",
              "test": "(not(cac:DocumentReference) or (cac:DocumentReference/cbc:DocumentTypeCode='130'))",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R044",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R044]-Charge on price level is NOT allowed. Only value 'false' allowed.",
              "context": "cac:Price/cac:AllowanceCharge",
              "test": "normalize-space(cbc:ChargeIndicator) = 'false'",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R046",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R046]-Item net price MUST equal (Gross price - Allowance amount) when gross price is provided.",
              "context": "cac:Price/cac:AllowanceCharge",
              "test": "not(cbc:BaseAmount) or xs:decimal(../cbc:PriceAmount) = xs:decimal(cbc:BaseAmount) - xs:decimal(cbc:Amount)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-R130",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-R130]-Unit code of price base quantity MUST be same as invoiced quantity.",
              "context": "cac:Price/cbc:BaseQuantity[@unitCode]",
              "test": "not($hasQuantity) or @unitCode = $quantity/@unitCode",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R040",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-COMMON-R040]-GLN must have a valid format according to GS1 rules.",
              "context": "cbc:EndpointID[@schemeID = '0088'] | cac:PartyIdentification/cbc:ID[@schemeID = '0088'] | cbc:CompanyID[@schemeID = '0088']",
              "test": "matches(normalize-space(), '^[0-9]+$') and u:gln(normalize-space())",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R041",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-COMMON-R041]-Norwegian organization number MUST be stated in the correct format.",
              "context": "cbc:EndpointID[@schemeID = '0192'] | cac:PartyIdentification/cbc:ID[@schemeID = '0192'] | cbc:CompanyID[@schemeID = '0192']",
              "test": "matches(normalize-space(), '^[0-9]{9}$') and u:mod11(normalize-space())",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R042",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-COMMON-R042]-Danish organization number (CVR) MUST be stated in the correct format.",
              "context": "cbc:EndpointID[@schemeID = '0184'] | cac:PartyIdentification/cbc:ID[@schemeID = '0184'] | cbc:CompanyID[@schemeID = '0184']",
              "test": "(string-length(string()) = 10 and substring(string(), 1, 2) = 'DK' and string-length(translate(substring(string(), 3, 8), '1234567890', '')) = 0)\n               or\n              (string-length(string()) = 8) and (string-length(translate(substring(string(), 1, 8),'1234567890', '')) = 0)",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R052",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-COMMON-R052]-Danish chamber of commerce number (P) MUST be stated in the correct format.",
              "context": "cbc:EndpointID[@schemeID = '0096'] | cac:PartyIdentification/cbc:ID[@schemeID = '0096'] | cbc:CompanyID[@schemeID = '0096']",
              "test": "(string-length(string()) = 10) and (string-length(translate(substring(string(), 1, 10),'1234567890', '')) = 0)",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R053",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-COMMON-R053]-Danish ERSTORG number (SE) MUST be stated in the correct format.",
              "context": "cbc:EndpointID[@schemeID = '0198'] | cac:PartyIdentification/cbc:ID[@schemeID = '0198'] | cbc:CompanyID[@schemeID = '0198']",
              "test": "(string-length(string()) = 10 and substring(string(), 1, 2) = 'DK' and string-length(translate(substring(string(), 3, 8), '1234567890', '')) = 0)",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R043",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-COMMON-R043]-Belgian enterprise number MUST be stated in the correct format.",
              "context": "cbc:EndpointID[@schemeID = '0208'] | cac:PartyIdentification/cbc:ID[@schemeID = '0208'] | cbc:CompanyID[@schemeID = '0208']",
              "test": "matches(normalize-space(), '^[0-9]{10}$') and u:mod97-0208(normalize-space())",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R044",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[PEPPOL-COMMON-R044]-IPA Code (Codice Univoco Unità Organizzativa) must be stated in the correct format",
              "context": "cbc:EndpointID[@schemeID = '0201'] | cac:PartyIdentification/cbc:ID[@schemeID = '0201'] | cbc:CompanyID[@schemeID = '0201']",
              "test": "u:checkCodiceIPA(normalize-space())",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R045",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[PEPPOL-COMMON-R045]-Tax Code (Codice Fiscale) must be stated in the correct format",
              "context": "cbc:EndpointID[@schemeID = '0210'] | cac:PartyIdentification/cbc:ID[@schemeID = '0210'] | cbc:CompanyID[@schemeID = '0210']",
              "test": "u:checkCF(normalize-space())",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R046",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[PEPPOL-COMMON-R046]-Tax Code (Codice Fiscale) must be stated in the correct format",
              "context": "cbc:EndpointID[@schemeID = '9907']",
              "test": "u:checkCF(normalize-space())",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R047",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[PEPPOL-COMMON-R047]-Italian VAT Code (Partita Iva) must be stated in the correct format",
              "context": "cbc:EndpointID[@schemeID = '0211'] | cac:PartyIdentification/cbc:ID[@schemeID = '0211'] | cbc:CompanyID[@schemeID = '0211']",
              "test": "u:checkPIVAseIT(normalize-space())",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R049",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-COMMON-R049]-Swedish organization number MUST be stated in the correct format.",
              "context": "cbc:EndpointID[@schemeID = '0007'] | cac:PartyIdentification/cbc:ID[@schemeID = '0007'] | cbc:CompanyID[@schemeID = '0007']",
              "test": "string-length(normalize-space()) = 10 and string(number(normalize-space())) != 'NaN' and u:checkSEOrgnr(normalize-space())",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R050",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-COMMON-R050]-Australian Business Number (ABN) MUST be stated in the correct format.",
              "context": "cbc:EndpointID[@schemeID = '0151'] | cac:PartyIdentification/cbc:ID[@schemeID = '0151'] | cbc:CompanyID[@schemeID = '0151']",
              "test": "matches(normalize-space(), '^[0-9]{11}$') and u:abn(normalize-space())",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R054",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[PEPPOL-COMMON-R054]-Dutch Chamber of Commerce (KVK) numbers (0106) MUST be stated in the correct format (12345678).",
              "context": "cbc:EndpointID[@schemeID = '0106'] | cac:PartyIdentification/cbc:ID[@schemeID = '0106'] | cbc:CompanyID[@schemeID = '0106']",
              "test": "matches(normalize-space(), '^[0-9]{8}$')",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R055",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[PEPPOL-COMMON-R055]-Dutch organization identification numbers (0190) MUST be stated in the correct format (12345678901234567890).",
              "context": "cbc:EndpointID[@schemeID = '0190'] | cac:PartyIdentification/cbc:ID[@schemeID = '0190'] | cbc:CompanyID[@schemeID = '0190']",
              "test": "matches(normalize-space(), '^[0-9]{20}$')",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R056-1",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[PEPPOL-COMMON-R056-1]-Dutch VAT numbers (9944) MUST be stated in the correct format (NL123456789B12).",
              "context": "cbc:EndpointID[@schemeID = '9944'] | cac:PartyIdentification/cbc:ID[@schemeID = '9944'] | cbc:CompanyID[@schemeID = '9944']",
              "test": "matches(normalize-space(), '^NL[0-9]{9}B[0-9]{2}$')",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R056-2",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[PEPPOL-COMMON-R056-2]-Dutch VAT numbers MUST have the format (NL123456789B12).",
              "context": "cac:PartyTaxScheme\n                   [normalize-space(cac:TaxScheme/cbc:ID) = 'VAT']\n                   /cbc:CompanyID\n                   [starts-with(normalize-space(.), 'NL')]",
              "test": "matches(normalize-space(.), '^NL[0-9]{9}B[0-9]{2}$')",
              "phases": null
            },
            {
              "id": "PEPPOL-COMMON-R057",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[PEPPOL-COMMON-R057]-Dutch Chamber of Commerce Establishment numbers (0217) MUST be stated in the correct format (123456789012).",
              "context": "cbc:EndpointID[@schemeID = '0217'] | cac:PartyIdentification/cbc:ID[@schemeID = '0217'] | cbc:CompanyID[@schemeID = '0217']",
              "test": "matches(normalize-space(), '^[0-9]{12}$')",
              "phases": null
            },
            {
              "id": "NO-R-002",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[NO-R-002]-For Norwegian suppliers, most invoice issuers are required to append \"Foretaksregisteret\" to their invoice. \"Dersom selger er aksjeselskap, allmennaksjeselskap eller filial av utenlandsk selskap skal også ordet «Foretaksregisteret» fremgå av salgsdokumentet, jf. foretaksregisterloven § 10-2.\"",
              "context": "cac:AccountingSupplierParty/cac:Party[$supplierCountry = 'NO']",
              "test": "normalize-space(cac:PartyTaxScheme[normalize-space(cac:TaxScheme/cbc:ID) = 'TAX']/cbc:CompanyID) = 'Foretaksregisteret'",
              "phases": null
            },
            {
              "id": "NO-R-001",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NO-R-001]-For Norwegian suppliers, a VAT number MUST be the country code prefix NO followed by a valid Norwegian organization number (nine numbers) followed by the letters MVA.",
              "context": "cac:AccountingSupplierParty/cac:Party[$supplierCountry = 'NO']",
              "test": "cac:PartyTaxScheme[normalize-space(cac:TaxScheme/cbc:ID) = 'VAT']/substring(cbc:CompanyID, 1, 2)='NO' and matches(cac:PartyTaxScheme[normalize-space(cac:TaxScheme/cbc:ID) = 'VAT']/substring(cbc:CompanyID,3), '^[0-9]{9}MVA$')\n          and u:mod11(substring(cac:PartyTaxScheme[normalize-space(cac:TaxScheme/cbc:ID) = 'VAT']/cbc:CompanyID, 3, 9)) or not(cac:PartyTaxScheme[normalize-space(cac:TaxScheme/cbc:ID) = 'VAT']/substring(cbc:CompanyID, 1, 2)='NO')",
              "phases": null
            },
            {
              "id": "DK-R-002",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-002]-Danish suppliers MUST provide legal entity (CVR-number)",
              "context": "ubl-creditnote:CreditNote[$DKSupplierCountry = 'DK'] | ubl-invoice:Invoice[$DKSupplierCountry = 'DK']",
              "test": "(normalize-space(cac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity/cbc:CompanyID/text()) != '')",
              "phases": null
            },
            {
              "id": "DK-R-014",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-014]-For Danish Suppliers it is mandatory to specify schemeID as \"0184\" (DK CVR-number) when PartyLegalEntity/CompanyID is used for AccountingSupplierParty",
              "context": "ubl-creditnote:CreditNote[$DKSupplierCountry = 'DK'] | ubl-invoice:Invoice[$DKSupplierCountry = 'DK']",
              "test": "not(((boolean(cac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity/cbc:CompanyID))\n\t\t\t\t\t\t\t   and (normalize-space(cac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity/cbc:CompanyID/@schemeID) != '0184'))\n\t\t\t\t\t\t)",
              "phases": null
            },
            {
              "id": "DK-R-016",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-016]-For Danish Suppliers, a Credit note cannot have a negative total (PayableAmount)",
              "context": "ubl-creditnote:CreditNote[$DKSupplierCountry = 'DK'] | ubl-invoice:Invoice[$DKSupplierCountry = 'DK']",
              "test": "not((boolean(/ubl-creditnote:CreditNote) and ($DKCustomerCountry = 'DK'))\n\t\t\t\t\t\tand (number(cac:LegalMonetaryTotal/cbc:PayableAmount/text()) < 0)\n\t\t\t\t\t\t)",
              "phases": null
            },
            {
              "id": "DK-R-013",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-013]-For Danish Suppliers it is mandatory to use schemeID when PartyIdentification/ID is used for AccountingCustomerParty or AccountingSupplierParty",
              "context": "ubl-creditnote:CreditNote[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/cac:AccountingSupplierParty/cac:Party/cac:PartyIdentification | ubl-creditnote:CreditNote[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/cac:AccountingCustomerParty/cac:Party/cac:PartyIdentification | ubl-invoice:Invoice[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/cac:AccountingSupplierParty/cac:Party/cac:PartyIdentification | ubl-invoice:Invoice[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/cac:AccountingCustomerParty/cac:Party/cac:PartyIdentification",
              "test": "not((boolean(cbc:ID))\n\t\t\t\t\t\t and (normalize-space(cbc:ID/@schemeID) = '')\n\t\t\t\t\t\t)",
              "phases": null
            },
            {
              "id": "DK-R-005",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-005]-For Danish suppliers the following Payment means codes are allowed: 1, 10, 31, 42, 48, 49, 50, 58, 59, 93 and 97",
              "context": "ubl-invoice:Invoice[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/cac:PaymentMeans",
              "test": "contains(' 1 10 31 42 48 49 50 58 59 93 97 ', concat(' ', cbc:PaymentMeansCode, ' '))",
              "phases": null
            },
            {
              "id": "DK-R-006",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-006]-For Danish suppliers bank account and registration account is mandatory if payment means is 31 or 42",
              "context": "ubl-invoice:Invoice[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/cac:PaymentMeans",
              "test": "not(((cbc:PaymentMeansCode = '31') or (cbc:PaymentMeansCode = '42'))\n\t\t\t\t\t\tand not((normalize-space(cac:PayeeFinancialAccount/cbc:ID/text()) != '') and (normalize-space(cac:PayeeFinancialAccount/cac:FinancialInstitutionBranch/cbc:ID/text()) != ''))\n\t\t\t\t\t\t)",
              "phases": null
            },
            {
              "id": "DK-R-007",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-007]-For Danish suppliers PaymentMandate/ID and PayerFinancialAccount/ID are mandatory when payment means is 49",
              "context": "ubl-invoice:Invoice[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/cac:PaymentMeans",
              "test": "not((cbc:PaymentMeansCode = '49')\n\t\t\t\t\t\tand not((normalize-space(cac:PaymentMandate/cbc:ID/text()) != '')\n\t\t\t\t\t\t\t   and (normalize-space(cac:PaymentMandate/cac:PayerFinancialAccount/cbc:ID/text()) != ''))\n\t\t\t\t\t\t)",
              "phases": null
            },
            {
              "id": "DK-R-008",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-008]-For Danish Suppliers PaymentID is mandatory and MUST start with 01#, 04# or 15# (kortartkode), and PayeeFinancialAccount/ID (Giro kontonummer) is mandatory and must be 7 or 8 numerical characters long, when payment means equals 50 (Giro)",
              "context": "ubl-invoice:Invoice[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/cac:PaymentMeans",
              "test": "not((cbc:PaymentMeansCode = '50')\n\t\t\t\t\t\tand not(((substring(cbc:PaymentID, 1, 3) = '01#')\n\t\t\t\t\t\t\t\t  or (substring(cbc:PaymentID, 1, 3) = '04#')\n\t\t\t\t\t\t\t\t  or (substring(cbc:PaymentID, 1, 3) = '15#'))\n\t\t\t\t\t\t\t\tand matches(cac:PayeeFinancialAccount/cbc:ID, '^[0-9]{7,8}$')\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)",
              "phases": null
            },
            {
              "id": "DK-R-009",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-009]-For Danish Suppliers if the PaymentID is prefixed with 04# or 15# the 16 digits instruction Id must be added to the PaymentID eg. \"04#1234567890123456\" when Payment means equals 50 (Giro)",
              "context": "ubl-invoice:Invoice[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/cac:PaymentMeans",
              "test": "not((cbc:PaymentMeansCode = '50')\n\t\t\t\t\t\tand ((substring(cbc:PaymentID, 1, 3) = '04#')\n\t\t\t\t\t\t\t  or (substring(cbc:PaymentID, 1, 3)  = '15#'))\n\t\t\t\t\t\tand not(string-length(cbc:PaymentID) = 19)\n\t\t\t\t\t\t)",
              "phases": null
            },
            {
              "id": "DK-R-010",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-010]-For Danish Suppliers using PaymentMeansCode 93, PaymentID is mandatory. The first three characters of the PaymentID MUST be 71#, 73# or 75# (kortartskode), and PayeeFinancialAccount/ID MUST be exactly 8 characters long.",
              "context": "ubl-invoice:Invoice[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/cac:PaymentMeans",
              "test": "not((cbc:PaymentMeansCode = '93')\n\t\t\t\t\t\tand not(((substring(cbc:PaymentID, 1, 3) = '71#')\n\t\t\t\t\t\t\t\t  or (substring(cbc:PaymentID, 1, 3) = '73#')\n\t\t\t\t\t\t\t\t  or (substring(cbc:PaymentID, 1, 3) = '75#'))\n\t\t\t\t\t\t\t\tand (string-length(cac:PayeeFinancialAccount/cbc:ID/text()) = 8)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)",
              "phases": null
            },
            {
              "id": "DK-R-011",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-011]-For Danish Suppliers if the PaymentID is prefixed with 71# or 75# the 15-16 digits instruction Id must be added to the PaymentID eg. \"71#1234567890123456\" when payment Method equals 93 (FIK)",
              "context": "ubl-invoice:Invoice[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/cac:PaymentMeans",
              "test": "not((cbc:PaymentMeansCode = '93')\n\t\t\t\t\t\tand ((substring(cbc:PaymentID, 1, 3) = '71#')\n\t\t\t\t\t\t\t  or (substring(cbc:PaymentID, 1, 3)  = '75#'))\n\t\t\t\t\t\tand not((string-length(cbc:PaymentID) = 18)\n\t\t\t\t\t\t\t  or (string-length(cbc:PaymentID) = 19))\n\t\t\t\t\t\t)",
              "phases": null
            },
            {
              "id": "DK-R-017",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-017]-For Danish Customers it is mandatory to specify schemeID as \"0184\" (DK CVR-number) when PartyLegalEntity/CompanyID is used for AccountingCustomerParty",
              "context": "ubl-creditnote:CreditNote[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/cac:AccountingCustomerParty/cac:Party | ubl-invoice:Invoice[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/cac:AccountingCustomerParty/cac:Party",
              "test": "not(((boolean(cac:PartyLegalEntity/cbc:CompanyID)) and (normalize-space(cac:PartyLegalEntity/cbc:CompanyID/@schemeID) != '0184')))",
              "phases": null
            },
            {
              "id": "DK-R-003",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-003]-If ItemClassification is provided from Danish suppliers, UNSPSC version 19.05.01 or 26.08.01 should be used.",
              "context": "ubl-creditnote:CreditNote[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/cac:CreditNoteLine | ubl-invoice:Invoice[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']/cac:InvoiceLine",
              "test": "not((cac:Item/cac:CommodityClassification/cbc:ItemClassificationCode/@listID = 'TST')\n\t\t\t\t\t\tand not((cac:Item/cac:CommodityClassification/cbc:ItemClassificationCode/@listVersionID = '19.05.01')\n\t\t\t\t\t\t\t   or (cac:Item/cac:CommodityClassification/cbc:ItemClassificationCode/@listVersionID = '19.0501')\n                               or (cac:Item/cac:CommodityClassification/cbc:ItemClassificationCode/@listVersionID = '26.08.01')\n                               or (cac:Item/cac:CommodityClassification/cbc:ItemClassificationCode/@listVersionID = '26.0801')\n\t\t\t\t\t\t\t   )\n\t\t\t\t\t\t)",
              "phases": null
            },
            {
              "id": "DK-R-004",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DK-R-004]-When specifying non-VAT Taxes for Danish customers, Danish suppliers MUST use the AllowanceChargeReasonCode=\"ZZZ\" and MUST be specified in AllowanceChargeReason; Either as the 4-digit Tax category or must include a #, but the # is not allowed as first and last character",
              "context": "cac:AllowanceCharge[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']",
              "test": "not((cbc:AllowanceChargeReasonCode = 'ZZZ')\n\t\t\t\t\t\tand not(((string-length(normalize-space(cbc:AllowanceChargeReason/text())) = 4)\n\t\t\t\t\t\t\t\tand (number(cbc:AllowanceChargeReason) >= 0)\n\t\t\t\t\t\t\t\tand (number(cbc:AllowanceChargeReason) <= 9999)) or\n\t\t\t\t\t\t\t\t(((cbc:AllowanceChargeReason and contains(cbc:AllowanceChargeReason, '#')\n                                  and not(starts-with(cbc:AllowanceChargeReason, '#'))\n                                  and not(ends-with(cbc:AllowanceChargeReason, '#')))) )\n                               )\n\t\t\t\t )",
              "phases": null
            },
            {
              "id": "IT-R-001",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[IT-R-001]-BT-32 (Seller tax registration identifier) - For Italian suppliers BT-32 minimum length 11 and maximum length shall be 16. Per i fornitori italiani il BT-32 deve avere una lunghezza tra 11 e 16 caratteri",
              "context": "cac:AccountingSupplierParty/cac:Party[$supplierCountry = 'IT']/cac:PartyTaxScheme[normalize-space(cac:TaxScheme/cbc:ID) != 'VAT']",
              "test": "matches(normalize-space(cbc:CompanyID),'^[A-Z0-9]{11,16}$')",
              "phases": null
            },
            {
              "id": "IT-R-002",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[IT-R-002]-BT-35 (Seller address line 1) - Italian suppliers MUST provide the postal address line 1 - I fornitori italiani devono indicare l'indirizzo postale.",
              "context": "cac:AccountingSupplierParty/cac:Party[$supplierCountry = 'IT']",
              "test": "cac:PostalAddress/cbc:StreetName",
              "phases": null
            },
            {
              "id": "IT-R-003",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[IT-R-003]-BT-37 (Seller city) - Italian suppliers MUST provide the postal address city - I fornitori italiani devono indicare la città di residenza.",
              "context": "cac:AccountingSupplierParty/cac:Party[$supplierCountry = 'IT']",
              "test": "cac:PostalAddress/cbc:CityName",
              "phases": null
            },
            {
              "id": "IT-R-004",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[IT-R-004]-BT-38 (Seller post code) - Italian suppliers MUST provide the postal address post code - I fornitori italiani devono indicare il CAP di residenza.",
              "context": "cac:AccountingSupplierParty/cac:Party[$supplierCountry = 'IT']",
              "test": "cac:PostalAddress/cbc:PostalZone",
              "phases": null
            },
            {
              "id": "SE-R-001",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[SE-R-001]-For Swedish suppliers, Swedish VAT-numbers must consist of 14 characters.",
              "context": "//cac:AccountingSupplierParty/cac:Party[cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'SE' and cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/substring(cbc:CompanyID, 1, 2) = 'SE']",
              "test": "string-length(normalize-space(cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/cbc:CompanyID)) = 14",
              "phases": null
            },
            {
              "id": "SE-R-002",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[SE-R-002]-For Swedish suppliers, the Swedish VAT-numbers must have the trailing 12 characters in numeric form",
              "context": "//cac:AccountingSupplierParty/cac:Party[cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'SE' and cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/substring(cbc:CompanyID, 1, 2) = 'SE']",
              "test": "string(number(substring(cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/cbc:CompanyID, 3, 12))) != 'NaN'",
              "phases": null
            },
            {
              "id": "SE-R-003",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[SE-R-003]-Swedish organisation numbers should be numeric.",
              "context": "//cac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity[../cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'SE' and cbc:CompanyID]",
              "test": "string(number(cbc:CompanyID)) != 'NaN'",
              "phases": null
            },
            {
              "id": "SE-R-004",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[SE-R-004]-Swedish organisation numbers consist of 10 characters.",
              "context": "//cac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity[../cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'SE' and cbc:CompanyID]",
              "test": "string-length(normalize-space(cbc:CompanyID)) = 10",
              "phases": null
            },
            {
              "id": "SE-R-013",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[SE-R-013]-The last digit of a Swedish organization number must be valid according to the Luhn algorithm.",
              "context": "//cac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity[../cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'SE' and cbc:CompanyID]",
              "test": "u:checkSEOrgnr(normalize-space(cbc:CompanyID))",
              "phases": null
            },
            {
              "id": "SE-R-005",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[SE-R-005]-For Swedish suppliers, when using Seller tax registration identifier, 'Godkänd för F-skatt' must be stated",
              "context": "//cac:AccountingSupplierParty/cac:Party[cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'SE' and exists(cac:PartyLegalEntity/cbc:CompanyID)]/cac:PartyTaxScheme[normalize-space(upper-case(cac:TaxScheme/cbc:ID)) != 'VAT']/cbc:CompanyID",
              "test": "normalize-space(upper-case(.)) = 'GODKÄND FÖR F-SKATT'",
              "phases": null
            },
            {
              "id": "SE-R-006",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[SE-R-006]-For Swedish suppliers, only standard VAT rate of 6, 12 or 25 are used",
              "context": "//cac:TaxCategory[//cac:AccountingSupplierParty/cac:Party[cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'SE' and cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/substring(cbc:CompanyID, 1, 2) = 'SE'] and cbc:ID = 'S'] | //cac:ClassifiedTaxCategory[//cac:AccountingSupplierParty/cac:Party[cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'SE' and cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/substring(cbc:CompanyID, 1, 2) = 'SE'] and cbc:ID = 'S']",
              "test": "number(cbc:Percent) = 25 or number(cbc:Percent) = 12 or number(cbc:Percent) = 6",
              "phases": null
            },
            {
              "id": "SE-R-007",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[SE-R-007]-For Swedish suppliers using Plusgiro, the Account ID must be numeric",
              "context": "//cac:PaymentMeans[//cac:AccountingSupplierParty/cac:Party[cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'SE'] and normalize-space(cbc:PaymentMeansCode) = '30' and normalize-space(cac:PayeeFinancialAccount/cac:FinancialInstitutionBranch/cbc:ID) = 'SE:PLUSGIRO']/cac:PayeeFinancialAccount/cbc:ID",
              "test": "string(number(normalize-space(.))) != 'NaN'",
              "phases": null
            },
            {
              "id": "SE-R-010",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[SE-R-010]-For Swedish suppliers using Plusgiro, the Account ID must have 2-8 characters",
              "context": "//cac:PaymentMeans[//cac:AccountingSupplierParty/cac:Party[cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'SE'] and normalize-space(cbc:PaymentMeansCode) = '30' and normalize-space(cac:PayeeFinancialAccount/cac:FinancialInstitutionBranch/cbc:ID) = 'SE:PLUSGIRO']/cac:PayeeFinancialAccount/cbc:ID",
              "test": "string-length(normalize-space(.)) >= 2 and string-length(normalize-space(.)) <= 8",
              "phases": null
            },
            {
              "id": "SE-R-008",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[SE-R-008]-For Swedish suppliers using Bankgiro, the Account ID must be numeric",
              "context": "//cac:PaymentMeans[//cac:AccountingSupplierParty/cac:Party[cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'SE'] and normalize-space(cbc:PaymentMeansCode) = '30' and normalize-space(cac:PayeeFinancialAccount/cac:FinancialInstitutionBranch/cbc:ID) = 'SE:BANKGIRO']/cac:PayeeFinancialAccount/cbc:ID",
              "test": "string(number(normalize-space(.))) != 'NaN'",
              "phases": null
            },
            {
              "id": "SE-R-009",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[SE-R-009]-For Swedish suppliers using Bankgiro, the Account ID must have 7-8 characters",
              "context": "//cac:PaymentMeans[//cac:AccountingSupplierParty/cac:Party[cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'SE'] and normalize-space(cbc:PaymentMeansCode) = '30' and normalize-space(cac:PayeeFinancialAccount/cac:FinancialInstitutionBranch/cbc:ID) = 'SE:BANKGIRO']/cac:PayeeFinancialAccount/cbc:ID",
              "test": "string-length(normalize-space(.)) = 7 or string-length(normalize-space(.)) = 8",
              "phases": null
            },
            {
              "id": "SE-R-011",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[SE-R-011]-For Swedish suppliers using Swedish Bankgiro or Plusgiro, the proper way to indicate this is to use Code 30 for PaymentMeans and FinancialInstitutionBranch ID with code SE:BANKGIRO or SE:PLUSGIRO",
              "context": "//cac:PaymentMeans[//cac:AccountingSupplierParty/cac:Party[cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'SE'] and (cbc:PaymentMeansCode = normalize-space('50') or cbc:PaymentMeansCode = normalize-space('56'))]",
              "test": "false()",
              "phases": null
            },
            {
              "id": "SE-R-012",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[SE-R-012]-For domestic transactions between Swedish trading partners, credit transfer should be indicated by PaymentMeansCode=\"30\"",
              "context": "//cac:PaymentMeans[//cac:AccountingSupplierParty/cac:Party[cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'SE']  and //cac:AccountingCustomerParty/cac:Party[cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'SE'] and (cbc:PaymentMeansCode = normalize-space('31'))]",
              "test": "false()",
              "phases": null
            },
            {
              "id": "GR-R-001-1",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[GR-R-001-1]- When the Supplier is Greek, the Invoice Id should consist of 6 segments",
              "context": "/ubl-invoice:Invoice/cbc:ID[$isGreekSender] | /ubl-creditnote:CreditNote/cbc:ID[$isGreekSender]",
              "test": "count($IdSegments) = 6",
              "phases": null
            },
            {
              "id": "GR-R-001-2",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[GR-R-001-2]-When the Supplier is Greek, the Invoice Id first segment must be a valid TIN Number and match either the Supplier's or the Tax Representative's Tin Number",
              "context": "/ubl-invoice:Invoice/cbc:ID[$isGreekSender] | /ubl-creditnote:CreditNote/cbc:ID[$isGreekSender]",
              "test": "string-length(normalize-space($IdSegments[1])) = 9\n\t\t\t                              and u:TinVerification($IdSegments[1])\n\t\t\t                              and ($IdSegments[1] = /*/cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/substring(cbc:CompanyID, 3, 9)\n\t\t\t                              or $IdSegments[1] = /*/cac:TaxRepresentativeParty/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/substring(cbc:CompanyID, 3, 9) )",
              "phases": null
            },
            {
              "id": "GR-R-001-3",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[GR-R-001-3]-When the Supplier is Greek, the Invoice Id second segment must be a valid Date that matches the invoice Issue Date",
              "context": "/ubl-invoice:Invoice/cbc:ID[$isGreekSender] | /ubl-creditnote:CreditNote/cbc:ID[$isGreekSender]",
              "test": "string-length(normalize-space($IdSegments[2]))>0\n\t\t\t                              and matches($IdSegments[2],$dateRegExp)\n\t\t\t                              and ($tokenizedIdDate[1] = $tokenizedUblIssueDate[3]\n\t\t\t                                and $tokenizedIdDate[2] = $tokenizedUblIssueDate[2]\n\t\t\t                                and $tokenizedIdDate[3] = $tokenizedUblIssueDate[1])",
              "phases": null
            },
            {
              "id": "GR-R-001-4",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[GR-R-001-4]-When Supplier is Greek, the Invoice Id third segment must be a positive integer",
              "context": "/ubl-invoice:Invoice/cbc:ID[$isGreekSender] | /ubl-creditnote:CreditNote/cbc:ID[$isGreekSender]",
              "test": "string-length(normalize-space($IdSegments[3]))>0 and string(number($IdSegments[3])) != 'NaN' and xs:integer($IdSegments[3]) >= 0",
              "phases": null
            },
            {
              "id": "GR-R-001-5",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[GR-R-001-5]-When Supplier is Greek, the Invoice Id in the fourth segment must be a valid greek document type",
              "context": "/ubl-invoice:Invoice/cbc:ID[$isGreekSender] | /ubl-creditnote:CreditNote/cbc:ID[$isGreekSender]",
              "test": "string-length(normalize-space($IdSegments[4]))>0 and (some $c in $greekDocumentType satisfies $IdSegments[4] = $c)",
              "phases": null
            },
            {
              "id": "GR-R-001-6",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[GR-R-001-6]-When Supplier is Greek, the Invoice Id fifth segment must not be empty",
              "context": "/ubl-invoice:Invoice/cbc:ID[$isGreekSender] | /ubl-creditnote:CreditNote/cbc:ID[$isGreekSender]",
              "test": "string-length($IdSegments[5]) > 0 ",
              "phases": null
            },
            {
              "id": "GR-R-001-7",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[GR-R-001-7]-When Supplier is Greek, the Invoice Id sixth segment must not be empty",
              "context": "/ubl-invoice:Invoice/cbc:ID[$isGreekSender] | /ubl-creditnote:CreditNote/cbc:ID[$isGreekSender]",
              "test": "string-length($IdSegments[6]) > 0 ",
              "phases": null
            },
            {
              "id": "GR-R-002",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[GR-R-002]-Greek Suppliers must provide their full name as they are registered in the Greek Business Registry (G.E.MH.) as a legal entity or in the Tax Registry as a natural person",
              "context": "cac:AccountingSupplierParty[$isGreekSender]/cac:Party",
              "test": "string-length(./cac:PartyName/cbc:Name)>0",
              "phases": null
            },
            {
              "id": "GR-S-011",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[GR-S-011]-Greek suppliers must provide their Seller Tax Registration Number, prefixed by the country code",
              "context": "cac:AccountingSupplierParty[$isGreekSender]/cac:Party",
              "test": "count(cac:PartyTaxScheme[normalize-space(cac:TaxScheme/cbc:ID) = 'VAT']/cbc:CompanyID)=1 and\n\t\t\t\t                        substring(cac:PartyTaxScheme[normalize-space(cac:TaxScheme/cbc:ID) = 'VAT']/cbc:CompanyID,1,2) = 'EL' and\n\t\t\t\t                        u:TinVerification(substring(cac:PartyTaxScheme[normalize-space(cac:TaxScheme/cbc:ID) = 'VAT']/cbc:CompanyID,3))",
              "phases": null
            },
            {
              "id": "GR-R-003",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[GR-R-003]-For the Greek Suppliers, the VAT must start with 'EL' and must be a valid TIN number",
              "context": "cac:AccountingSupplierParty[$isGreekSender]/cac:Party/cac:PartyTaxScheme[normalize-space(cac:TaxScheme/cbc:ID) = 'VAT']/cbc:CompanyID",
              "test": "substring(.,1,2) = 'EL' and u:TinVerification(substring(.,3))",
              "phases": null
            },
            {
              "id": "GR-R-004-1",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[GR-R-004-1]- When Supplier is Greek, there must be one MARK Number",
              "context": "/ubl-invoice:Invoice[$isGreekSender and ( /*/cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'GR')] | /ubl-creditnote:CreditNote[$isGreekSender and ( /*/cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'GR')]",
              "test": "count(cac:AdditionalDocumentReference[cbc:DocumentDescription = '##M.AR.K##'])=1",
              "phases": null
            },
            {
              "id": "GR-S-008-1",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[GR-S-008-1]-When Supplier is Greek, there should be one invoice url",
              "context": "/ubl-invoice:Invoice[$isGreekSender and ( /*/cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'GR')] | /ubl-creditnote:CreditNote[$isGreekSender and ( /*/cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'GR')]",
              "test": "count(cac:AdditionalDocumentReference[cbc:DocumentDescription = '##INVOICE|URL##'])=1",
              "phases": null
            },
            {
              "id": "GR-R-008-2",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[GR-R-008-2]-When Supplier is Greek, there should be no more than one invoice url",
              "context": "/ubl-invoice:Invoice[$isGreekSender and ( /*/cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'GR')] | /ubl-creditnote:CreditNote[$isGreekSender and ( /*/cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'GR')]",
              "test": "(count(cac:AdditionalDocumentReference[cbc:DocumentDescription = '##INVOICE|URL##']) = 0 ) or (count(cac:AdditionalDocumentReference[cbc:DocumentDescription = '##INVOICE|URL##']) = 1 )",
              "phases": null
            },
            {
              "id": "GR-R-004-2",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[GR-R-004-2]-When Supplier is Greek, the MARK Number must be a positive integer",
              "context": "cac:AdditionalDocumentReference[$isGreekSender and ( /*/cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'GR') and cbc:DocumentDescription = '##M.AR.K##']/cbc:ID",
              "test": "matches(.,'^[1-9]([0-9]*)')",
              "phases": null
            },
            {
              "id": "GR-R-008-3",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[GR-R-008-3]-When Supplier is Greek and the INVOICE URL Document reference exists, the External Reference URI should be present",
              "context": "cac:AdditionalDocumentReference[$isGreekSender and cbc:DocumentDescription = '##INVOICE|URL##']",
              "test": "string-length(normalize-space(cac:Attachment/cac:ExternalReference/cbc:URI))>0",
              "phases": null
            },
            {
              "id": "GR-R-005",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[GR-R-005]-Greek Suppliers must provide the full name of the buyer",
              "context": "cac:AccountingCustomerParty[$isGreekSender]/cac:Party",
              "test": "string-length(./cac:PartyName/cbc:Name)>0",
              "phases": null
            },
            {
              "id": "GR-R-009",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[GR-R-009]-Greek suppliers that send an invoice through the PEPPOL network must use a correct TIN number as an electronic address according to PEPPOL Electronic Address Identifier scheme (schemeID 9933).",
              "context": "cac:AccountingSupplierParty/cac:Party[$accountingSupplierCountry='GR' or $accountingSupplierCountry='EL']/cbc:EndpointID",
              "test": "./@schemeID='9933' and u:TinVerification(.)",
              "phases": null
            },
            {
              "id": "GR-R-006",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[GR-R-006]-Greek Suppliers must provide the VAT number of the buyer, if the buyer is Greek",
              "context": "cac:AccountingCustomerParty[$isGreekSenderandReceiver]/cac:Party",
              "test": "count(cac:PartyTaxScheme[normalize-space(cac:TaxScheme/cbc:ID) = 'VAT']/cbc:CompanyID)=1 and\n\t\t\t\t                        substring(cac:PartyTaxScheme[normalize-space(cac:TaxScheme/cbc:ID) = 'VAT']/cbc:CompanyID,1,2) = 'EL' and\n\t\t\t\t                        u:TinVerification(substring(cac:PartyTaxScheme[normalize-space(cac:TaxScheme/cbc:ID) = 'VAT']/cbc:CompanyID,3))",
              "phases": null
            },
            {
              "id": "GR-R-010",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[GR-R-010]-Greek Suppliers that send an invoice through the PEPPOL network to a greek buyer must use a correct TIN number as an electronic address according to PEPPOL Electronic Address Identifier scheme (SchemeID 9933)",
              "context": "cac:AccountingCustomerParty[$isGreekSenderandReceiver]/cac:Party/cbc:EndpointID",
              "test": "./@schemeID='9933' and u:TinVerification(.)",
              "phases": null
            },
            {
              "id": "IS-R-001",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[IS-R-001]-If seller is icelandic then invoice type should be 380 or 381 — Ef seljandi er íslenskur þá ætti gerð reiknings (BT-3) að vera sölureikningur (380) eða kreditreikningur (381).",
              "context": "ubl-creditnote:CreditNote[$SupplierCountry = 'IS'] | ubl-invoice:Invoice[$SupplierCountry = 'IS']",
              "test": "( ( not(contains(normalize-space(cbc:InvoiceTypeCode),' ')) and contains( ' 380 381 ',concat(' ',normalize-space(cbc:InvoiceTypeCode),' ') ) ) ) or ( ( not(contains(normalize-space(cbc:CreditNoteTypeCode),' ')) and contains( ' 380 381 ',concat(' ',normalize-space(cbc:CreditNoteTypeCode),' ') ) ) )",
              "phases": null
            },
            {
              "id": "IS-R-002",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[IS-R-002]-If seller is icelandic then it shall contain sellers legal id — Ef seljandi er íslenskur þá skal reikningur innihalda íslenska kennitölu seljanda (BT-30).",
              "context": "ubl-creditnote:CreditNote[$SupplierCountry = 'IS'] | ubl-invoice:Invoice[$SupplierCountry = 'IS']",
              "test": "exists(cac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity/cbc:CompanyID) and cac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity/cbc:CompanyID/@schemeID = '0196'",
              "phases": null
            },
            {
              "id": "IS-R-003",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[IS-R-003]-If seller is icelandic then it shall contain his address with street name and zip code — Ef seljandi er íslenskur þá skal heimilisfang seljanda innihalda götuheiti og póstnúmer (BT-35 og BT-38).",
              "context": "ubl-creditnote:CreditNote[$SupplierCountry = 'IS'] | ubl-invoice:Invoice[$SupplierCountry = 'IS']",
              "test": "exists(cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cbc:StreetName) and exists(cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cbc:PostalZone)",
              "phases": null
            },
            {
              "id": "IS-R-006",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[IS-R-006]-If seller is icelandic and payment means code is 9 then a 12 digit account id must exist — Ef seljandi er íslenskur og greiðslumáti (BT-81) er krafa (kóti 9) þá skal koma fram 12 stafa númer (bankanúmer, höfuðbók 66 og reikningsnúmer) (BT-84)",
              "context": "ubl-creditnote:CreditNote[$SupplierCountry = 'IS'] | ubl-invoice:Invoice[$SupplierCountry = 'IS']",
              "test": "exists(cac:PaymentMeans[cbc:PaymentMeansCode = '9']/cac:PayeeFinancialAccount/cbc:ID)\n\t\t\t\t\t  and string-length(normalize-space(cac:PaymentMeans[cbc:PaymentMeansCode = '9']/cac:PayeeFinancialAccount/cbc:ID)) = 12\n\t\t\t\t\t  or not(exists(cac:PaymentMeans[cbc:PaymentMeansCode = '9']))",
              "phases": null
            },
            {
              "id": "IS-R-007",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[IS-R-007]-If seller is icelandic and payment means code is 42 then a 12 digit account id must exist — Ef seljandi er íslenskur og greiðslumáti (BT-81) er millifærsla (kóti 42) þá skal koma fram 12 stafa reikningnúmer (BT-84)",
              "context": "ubl-creditnote:CreditNote[$SupplierCountry = 'IS'] | ubl-invoice:Invoice[$SupplierCountry = 'IS']",
              "test": "exists(cac:PaymentMeans[cbc:PaymentMeansCode = '42']/cac:PayeeFinancialAccount/cbc:ID)\n\t\t\t\t\t  and string-length(normalize-space(cac:PaymentMeans[cbc:PaymentMeansCode = '42']/cac:PayeeFinancialAccount/cbc:ID)) = 12\n\t\t\t\t\t  or not(exists(cac:PaymentMeans[cbc:PaymentMeansCode = '42']))",
              "phases": null
            },
            {
              "id": "IS-R-008",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[IS-R-008]-If seller is icelandic and invoice contains supporting description EINDAGI then the id form must be YYYY-MM-DD — Ef seljandi er íslenskur þá skal eindagi (BT-122, DocumentDescription = EINDAGI) vera á forminu YYYY-MM-DD.",
              "context": "ubl-creditnote:CreditNote[$SupplierCountry = 'IS'] | ubl-invoice:Invoice[$SupplierCountry = 'IS']",
              "test": "(exists(cac:AdditionalDocumentReference[cbc:DocumentDescription = 'EINDAGI']) and string-length(cac:AdditionalDocumentReference[cbc:DocumentDescription = 'EINDAGI']/cbc:ID) = 10 and (string(cac:AdditionalDocumentReference[cbc:DocumentDescription = 'EINDAGI']/cbc:ID) castable as xs:date)) or not(exists(cac:AdditionalDocumentReference[cbc:DocumentDescription = 'EINDAGI']))",
              "phases": null
            },
            {
              "id": "IS-R-009",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[IS-R-009]-If seller is icelandic and invoice contains supporting description EINDAGI invoice must have due date — Ef seljandi er íslenskur þá skal reikningur sem inniheldur eindaga (BT-122, DocumentDescription = EINDAGI) einnig hafa gjalddaga (BT-9).",
              "context": "ubl-creditnote:CreditNote[$SupplierCountry = 'IS'] | ubl-invoice:Invoice[$SupplierCountry = 'IS']",
              "test": "(exists(cac:AdditionalDocumentReference[cbc:DocumentDescription = 'EINDAGI']) and exists(cbc:DueDate)) or not(exists(cac:AdditionalDocumentReference[cbc:DocumentDescription = 'EINDAGI']))",
              "phases": null
            },
            {
              "id": "IS-R-010",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[IS-R-010]-If seller is icelandic and invoice contains supporting description EINDAGI the id date must be same or later than due date — Ef seljandi er íslenskur þá skal eindagi (BT-122, DocumentDescription = EINDAGI) skal vera sami eða síðar en gjalddagi (BT-9) ef eindagi er til staðar.",
              "context": "ubl-creditnote:CreditNote[$SupplierCountry = 'IS'] | ubl-invoice:Invoice[$SupplierCountry = 'IS']",
              "test": "(exists(cac:AdditionalDocumentReference[cbc:DocumentDescription = 'EINDAGI']) and (cbc:DueDate) <= (cac:AdditionalDocumentReference[cbc:DocumentDescription = 'EINDAGI']/cbc:ID)) or not(exists(cac:AdditionalDocumentReference[cbc:DocumentDescription = 'EINDAGI']))",
              "phases": null
            },
            {
              "id": "IS-R-004",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[IS-R-004]-If seller and buyer are icelandic then the invoice shall contain the buyers icelandic legal identifier — Ef seljandi og kaupandi eru íslenskir þá skal reikningurinn innihalda íslenska kennitölu kaupanda (BT-47).",
              "context": "ubl-creditnote:CreditNote[$SupplierCountry = 'IS' and $CustomerCountry = 'IS']/cac:AccountingCustomerParty | ubl-invoice:Invoice[$SupplierCountry = 'IS' and $CustomerCountry = 'IS']/cac:AccountingCustomerParty",
              "test": "exists(cac:Party/cac:PartyLegalEntity/cbc:CompanyID) and cac:Party/cac:PartyLegalEntity/cbc:CompanyID/@schemeID = '0196'",
              "phases": null
            },
            {
              "id": "IS-R-005",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[IS-R-005]-If seller and buyer are icelandic then the invoice shall contain the buyers address with street name and zip code — Ef seljandi og kaupandi eru íslenskir þá skal heimilisfang kaupanda innihalda götuheiti og póstnúmer (BT-50 og BT-53)",
              "context": "ubl-creditnote:CreditNote[$SupplierCountry = 'IS' and $CustomerCountry = 'IS']/cac:AccountingCustomerParty | ubl-invoice:Invoice[$SupplierCountry = 'IS' and $CustomerCountry = 'IS']/cac:AccountingCustomerParty",
              "test": "exists(cac:Party/cac:PostalAddress/cbc:StreetName) and exists(cac:Party/cac:PostalAddress/cbc:PostalZone)",
              "phases": null
            },
            {
              "id": "NL-R-001",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NL-R-001]-For suppliers in the Netherlands, if the document is a creditnote, the document MUST contain an invoice reference (cac:BillingReference/cac:InvoiceDocumentReference/cbc:ID)",
              "context": "cbc:CreditNoteTypeCode[$supplierCountryIsNL]",
              "test": "/*/cac:BillingReference/cac:InvoiceDocumentReference/cbc:ID",
              "phases": null
            },
            {
              "id": "NL-R-002",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NL-R-002]-For suppliers in the Netherlands the supplier's address (cac:AccountingSupplierParty/cac:Party/cac:PostalAddress) MUST contain street name (cbc:StreetName), city (cbc:CityName) and post code (cbc:PostalZone)",
              "context": "cac:AccountingSupplierParty/cac:Party/cac:PostalAddress[$supplierCountryIsNL]",
              "test": "cbc:StreetName and cbc:CityName and cbc:PostalZone",
              "phases": null
            },
            {
              "id": "NL-R-003",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NL-R-003]-For suppliers in the Netherlands, the legal entity identifier MUST be either a KVK or OIN number (schemeID 0106 or 0190)",
              "context": "cac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity/cbc:CompanyID[$supplierCountryIsNL]",
              "test": "(contains(concat(' ', string-join(@schemeID, ' '), ' '), ' 0106 ') or contains(concat(' ', string-join(@schemeID, ' '), ' '), ' 0190 ')) and (normalize-space(.) != '')",
              "phases": null
            },
            {
              "id": "NL-R-004",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NL-R-004]-For suppliers in the Netherlands, if the customer is in the Netherlands, the customer address (cac:AccountingCustomerParty/cac:Party/cac:PostalAddress) MUST contain the street name (cbc:StreetName), the city (cbc:CityName) and post code (cbc:PostalZone)",
              "context": "cac:AccountingCustomerParty/cac:Party/cac:PostalAddress[$supplierCountryIsNL and $customerCountryIsNL]",
              "test": "cbc:StreetName and cbc:CityName and cbc:PostalZone",
              "phases": null
            },
            {
              "id": "NL-R-005",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NL-R-005]-For suppliers in the Netherlands, if the customer is in the Netherlands, the customer's legal entity identifier MUST be either a KVK or OIN number (schemeID 0106 or 0190)",
              "context": "cac:AccountingCustomerParty/cac:Party/cac:PartyLegalEntity/cbc:CompanyID[$supplierCountryIsNL and $customerCountryIsNL]",
              "test": "(contains(concat(' ', string-join(@schemeID, ' '), ' '), ' 0106 ') or contains(concat(' ', string-join(@schemeID, ' '), ' '), ' 0190 ')) and (normalize-space(.) != '')",
              "phases": null
            },
            {
              "id": "NL-R-006",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NL-R-006]-For suppliers in the Netherlands, if the fiscal representative is in the Netherlands, the representative's address (cac:TaxRepresentativeParty/cac:PostalAddress) MUST contain street name (cbc:StreetName), city (cbc:CityName) and post code (cbc:PostalZone)",
              "context": "cac:TaxRepresentativeParty/cac:PostalAddress[$supplierCountryIsNL and $taxRepresentativeCountryIsNL]",
              "test": "cbc:StreetName and cbc:CityName and cbc:PostalZone",
              "phases": null
            },
            {
              "id": "NL-R-007",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NL-R-007]-For suppliers in the Netherlands, the supplier MUST provide a means of payment (cac:PaymentMeans) if the payment is from customer to supplier",
              "context": "cac:LegalMonetaryTotal[$supplierCountryIsNL]",
              "test": "(/ubl-invoice:Invoice and xs:decimal(cbc:PayableAmount) <= 0.0) or (/ubl-creditnote:CreditNote and xs:decimal(cbc:PayableAmount) >= 0.0) or (//cac:PaymentMeans)",
              "phases": null
            },
            {
              "id": "NL-R-008",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NL-R-008]-For suppliers in the Netherlands, if the customer is in the Netherlands, the payment means code (cac:PaymentMeans/cbc:PaymentMeansCode) MUST be one of 30, 48, 49, 57, 58 or 59",
              "context": "cac:PaymentMeans[$supplierCountryIsNL and $customerCountryIsNL]",
              "test": "normalize-space(cbc:PaymentMeansCode) = '30' or\n        normalize-space(cbc:PaymentMeansCode) = '48' or\n        normalize-space(cbc:PaymentMeansCode) = '49' or\n        normalize-space(cbc:PaymentMeansCode) = '57' or\n        normalize-space(cbc:PaymentMeansCode) = '58' or\n        normalize-space(cbc:PaymentMeansCode) = '59'",
              "phases": null
            },
            {
              "id": "NL-R-009",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[NL-R-009]-For suppliers in the Netherlands, if an order line reference (cac:OrderLineReference/cbc:LineID) is used, there must be an order reference on the document level (cac:OrderReference/cbc:ID)",
              "context": "cac:OrderLineReference/cbc:LineID[$supplierCountryIsNL]",
              "test": "exists(/*/cac:OrderReference/cbc:ID)",
              "phases": null
            },
            {
              "id": "DE-R-001",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-001]-If both supplier and customer are located in Germany, an invoice shall contain information on \"PAYMENT INSTRUCTIONS\" (BG-16).",
              "context": "(/ubl-invoice:Invoice | /ubl-creditnote:CreditNote)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "cac:PaymentMeans",
              "phases": null
            },
            {
              "id": "DE-R-015",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-015]-If both supplier and customer are located in Germany, the element \"Buyer reference\" (BT-10) shall be provided.",
              "context": "(/ubl-invoice:Invoice | /ubl-creditnote:CreditNote)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "cbc:BuyerReference[boolean(normalize-space(.))]",
              "phases": null
            },
            {
              "id": "DE-R-016",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-016]-If both supplier and customer are located in Germany, and if one of the VAT codes S, Z, E, AE, K, G, L, or M is used, an invoice shall contain at least one of the following elements: \"Seller VAT identifier\" (BT-31) or \"Seller tax registration identifier\" (BT-32) or \"SELLER TAX REPRESENTATIVE PARTY\" (BG-11).",
              "context": "(/ubl-invoice:Invoice | /ubl-creditnote:CreditNote)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "         (not(           ($BT-95-UBL-Inv = $supportedVATCodes or $BT-95-UBL-CN = $supportedVATCodes) or           ($BT-102 = $supportedVATCodes) or           ($BT-151 = $supportedVATCodes)         ) or         (cac:TaxRepresentativeParty, $BT-31orBT-32Path))         ",
              "phases": null
            },
            {
              "id": "DE-R-017",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[DE-R-017]-If both supplier and customer are located in Germany, the element \"Invoice type code\" (BT-3) should only contain the following values from code list UNTDID 1001: 326 (Partial invoice), 380 (Commercial invoice), 384 (Corrected invoice), 389 (Self-billed invoice), 381 (Credit note), 875 (Partial construction invoice), 876 (Partial final construction invoice), 877 (Final construction invoice).",
              "context": "(/ubl-invoice:Invoice | /ubl-creditnote:CreditNote)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "normalize-space(cbc:InvoiceTypeCode) = $supportedInvAndCNTypeCodes         or normalize-space(cbc:CreditNoteTypeCode) = $supportedInvAndCNTypeCodes",
              "phases": null
            },
            {
              "id": "DE-R-018",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-018]-If both supplier and customer are located in Germany, information on cash discounts for prompt payment (Skonto) shall be provided within the element \"Payment terms\" BT-20 in the following way: First segment \"SKONTO\", second segment amount of days (\"TAGE=N\"), third segment percentage (\"PROZENT=N\"). Percentage must be separated by dot with two decimal places. In case the base value of the invoiced amount is not provided in BT-115 but as a partial amount, the base value shall be provided as fourth segment \"BASISBETRAG=N\" as semantic data type amount. Each entry shall start with a #, the segments must be separated by # and a row shall end with a #. A complete statement on cash discount for prompt payment shall end with a XML-conformant line break. All statements on cash discount for prompt payment shall be given in capital letters. Additional whitespaces (blanks, tabulators or line breaks) are not allowed. Other characters or texts than defined above are not allowed.",
              "context": "(/ubl-invoice:Invoice | /ubl-creditnote:CreditNote)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "every $line in             cac:PaymentTerms/cbc:Note[1]/tokenize(. , '(\\r?\\n)')[starts-with( normalize-space(.) , '#')]              satisfies matches ( normalize-space ($line), $XR-SKONTO-REGEX)                                  and                                 matches( cac:PaymentTerms/cbc:Note[1]/tokenize(. ,  '#.+#')[last()], '^\\s*\\n' )",
              "phases": null
            },
            {
              "id": "DE-R-022",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-022]-If both supplier and customer are located in Germany, attached documents provided with an invoice in \"ADDITIONAL SUPPORTING DOCUMENTS\" (BG-24) shall have a unique filename (non case-sensitive) within the element ″Attached document″ (BT-125).",
              "context": "(/ubl-invoice:Invoice | /ubl-creditnote:CreditNote)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "count(cac:AdditionalDocumentReference) =                      count(cac:AdditionalDocumentReference[not(./cac:Attachment/cbc:EmbeddedDocumentBinaryObject/@filename = preceding-sibling::cac:AdditionalDocumentReference/cac:Attachment/cbc:EmbeddedDocumentBinaryObject/@filename)])",
              "phases": null
            },
            {
              "id": "DE-R-026",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[DE-R-026]-If both supplier and customer are located in Germany, and if \"Invoice type code\" (BT-3) contains the code 384 (Corrected invoice), \"PRECEDING INVOICE REFERENCE\" (BG-3) should be provided at least once.",
              "context": "(/ubl-invoice:Invoice | /ubl-creditnote:CreditNote)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "((not(normalize-space(cbc:InvoiceTypeCode) = '384' or normalize-space(cbc:CreditNoteTypeCode) = '384') or                     (cac:BillingReference/cac:InvoiceDocumentReference)))",
              "phases": null
            },
            {
              "id": "DE-R-030",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-030]-If both supplier and customer are located in Germany, and if the group \"DIRECT DEBIT\" (BG-19) is delivered, the element \"Bank assigned creditor identifier\" (BT-90) shall be provided.",
              "context": "(/ubl-invoice:Invoice | /ubl-creditnote:CreditNote)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "not(cac:PaymentMeans/cac:PaymentMandate)                        or (cac:AccountingSupplierParty/cac:Party/cac:PartyIdentification/cbc:ID[@schemeID='SEPA']                          | cac:PayeeParty/cac:PartyIdentification/cbc:ID[@schemeID='SEPA'])",
              "phases": null
            },
            {
              "id": "DE-R-031",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-031]-If both supplier and customer are located in Germany, and if the group \"DIRECT DEBIT\" (BG-19) is delivered, the element \"Debited account identifier\" (BT-91) shall be provided.",
              "context": "(/ubl-invoice:Invoice | /ubl-creditnote:CreditNote)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "not(cac:PaymentMeans/cac:PaymentMandate) or (cac:PaymentMeans/cac:PaymentMandate/cac:PayerFinancialAccount/cbc:ID)",
              "phases": null
            },
            {
              "id": "DE-R-T02",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[DE-R-T02]-If both supplier and customer are located in Germany, BT-124 \"External document location\" must contain an absolute URL with valid scheme.",
              "context": "(/ubl-invoice:Invoice/cac:AdditionalDocumentReference/cac:Attachment/cac:ExternalReference | /ubl-creditnote:CreditNote/cac:AdditionalDocumentReference/cac:Attachment/cac:ExternalReference)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "matches(cbc:URI, $XR-URL-REGEX)",
              "phases": null
            },
            {
              "id": "DE-R-002",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-002]-If both supplier and customer are located in Germany, the group \"SELLER CONTACT\" (BG-6) shall be provided.",
              "context": "(/ubl-invoice:Invoice/cac:AccountingSupplierParty | /ubl-creditnote:CreditNote/cac:AccountingSupplierParty)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "cac:Party/cac:Contact",
              "phases": null
            },
            {
              "id": "DE-R-003",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-003]-If both supplier and customer are located in Germany, the element \"Seller city\" (BT-37) shall be provided.",
              "context": "(/ubl-invoice:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PostalAddress | /ubl-creditnote:CreditNote/cac:AccountingSupplierParty/cac:Party/cac:PostalAddress)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "cbc:CityName[boolean(normalize-space(.))]",
              "phases": null
            },
            {
              "id": "DE-R-004",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-004]-If both supplier and customer are located in Germany, the element \"Seller post code\" (BT-38) shall be provided.",
              "context": "(/ubl-invoice:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PostalAddress | /ubl-creditnote:CreditNote/cac:AccountingSupplierParty/cac:Party/cac:PostalAddress)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "cbc:PostalZone[boolean(normalize-space(.))]",
              "phases": null
            },
            {
              "id": "DE-R-005",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-005]-If both supplier and customer are located in Germany, the element \"Seller contact point\" (BT-41) shall be provided.",
              "context": "(/ubl-invoice:Invoice/cac:AccountingSupplierParty/cac:Party/cac:Contact | /ubl-creditnote:CreditNote/cac:AccountingSupplierParty/cac:Party/cac:Contact)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "cbc:Name[boolean(normalize-space(.))]",
              "phases": null
            },
            {
              "id": "DE-R-006",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-006]-If both supplier and customer are located in Germany, the element \"Seller contact telephone number\" (BT-42) shall be provided.",
              "context": "(/ubl-invoice:Invoice/cac:AccountingSupplierParty/cac:Party/cac:Contact | /ubl-creditnote:CreditNote/cac:AccountingSupplierParty/cac:Party/cac:Contact)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "cbc:Telephone[boolean(normalize-space(.))]",
              "phases": null
            },
            {
              "id": "DE-R-007",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-007]-If both supplier and customer are located in Germany, the element \"Seller contact email address\" (BT-43) shall be provided.",
              "context": "(/ubl-invoice:Invoice/cac:AccountingSupplierParty/cac:Party/cac:Contact | /ubl-creditnote:CreditNote/cac:AccountingSupplierParty/cac:Party/cac:Contact)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "cbc:ElectronicMail[boolean(normalize-space(.))]",
              "phases": null
            },
            {
              "id": "DE-R-027",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[DE-R-027]-If both supplier and customer are located in Germany, \"Seller contact telephone number\" (BT-42) should contain a valid telephone number. A valid telephone should consist of 3 digits minimum.",
              "context": "(/ubl-invoice:Invoice/cac:AccountingSupplierParty/cac:Party/cac:Contact | /ubl-creditnote:CreditNote/cac:AccountingSupplierParty/cac:Party/cac:Contact)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "matches(normalize-space(cbc:Telephone), $XR-TELEPHONE-REGEX)",
              "phases": null
            },
            {
              "id": "DE-R-028",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[DE-R-028]-If both supplier and customer are located in Germany, \"Seller contact email address\" (BT-43) should contain exactly one @-sign, which should not be framed by a whitespace or a dot but by at least two characters on each side. A dot should not be the first or last character.",
              "context": "(/ubl-invoice:Invoice/cac:AccountingSupplierParty/cac:Party/cac:Contact | /ubl-creditnote:CreditNote/cac:AccountingSupplierParty/cac:Party/cac:Contact)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "matches(normalize-space(cbc:ElectronicMail), $XR-EMAIL-REGEX)",
              "phases": null
            },
            {
              "id": "DE-R-008",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-008]-If both supplier and customer are located in Germany, the element \"Buyer city\" (BT-52) shall be provided.",
              "context": "(/ubl-invoice:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PostalAddress | /ubl-creditnote:CreditNote/cac:AccountingCustomerParty/cac:Party/cac:PostalAddress)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "cbc:CityName[boolean(normalize-space(.))]",
              "phases": null
            },
            {
              "id": "DE-R-009",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-009]-If both supplier and customer are located in Germany, the element \"Buyer post code\" (BT-53) shall be provided.",
              "context": "(/ubl-invoice:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PostalAddress | /ubl-creditnote:CreditNote/cac:AccountingCustomerParty/cac:Party/cac:PostalAddress)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "cbc:PostalZone[boolean(normalize-space(.))]",
              "phases": null
            },
            {
              "id": "DE-R-010",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-010]-If both supplier and customer are located in Germany, the element \"Deliver to city\" (BT-77) shall be provided if the group \"DELIVER TO ADDRESS\" (BG-15) is delivered.",
              "context": "(/ubl-invoice:Invoice/cac:Delivery/cac:DeliveryLocation/cac:Address | /ubl-creditnote:CreditNote/cac:Delivery/cac:DeliveryLocation/cac:Address)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "cbc:CityName[boolean(normalize-space(.))]",
              "phases": null
            },
            {
              "id": "DE-R-011",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-011]-If both supplier and customer are located in Germany, the element \"Deliver to post code\" (BT-78) shall be provided if the group \"DELIVER TO ADDRESS\" (BG-15) is delivered.",
              "context": "(/ubl-invoice:Invoice/cac:Delivery/cac:DeliveryLocation/cac:Address | /ubl-creditnote:CreditNote/cac:Delivery/cac:DeliveryLocation/cac:Address)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "cbc:PostalZone[boolean(normalize-space(.))]",
              "phases": null
            },
            {
              "id": "DE-R-019",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[DE-R-019]-If both supplier and customer are located in Germany, the element \"Payment account identifier\" (BT-84) should contain a valid IBAN if code 58 SEPA is provided in \"Payment means type code\" (BT-81).",
              "context": "(/ubl-invoice:Invoice/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('30','58')] | /ubl-creditnote:CreditNote/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('30','58')])[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "not(normalize-space(cbc:PaymentMeansCode) = '58') or                     matches(normalize-space(replace(cac:PayeeFinancialAccount/cbc:ID, '([ \\n\\r\\t\\s])', '')), '^[A-Z]{2}[0-9]{2}[a-zA-Z0-9]{0,30}$') and                     xs:integer(string-join(for $cp in string-to-codepoints(concat(substring(normalize-space(replace(cac:PayeeFinancialAccount/cbc:ID, '([ \\n\\r\\t\\s])', '')),5),upper-case(substring(normalize-space(replace(cac:PayeeFinancialAccount/cbc:ID, '([ \\n\\r\\t\\s])', '')),1,2)),substring(normalize-space(replace(cac:PayeeFinancialAccount/cbc:ID, '([ \\n\\r\\t\\s])', '')),3,2))) return  (if($cp > 64) then string($cp - 55) else  string($cp - 48)),'')) mod 97 = 1",
              "phases": null
            },
            {
              "id": "DE-R-023-1",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-023-1]-If both supplier and customer are German, if \"Payment means type code\" (BT-81) contains a code for credit transfer (30, 58), \"CREDIT TRANSFER\" (BG-17) shall be provided.",
              "context": "(/ubl-invoice:Invoice/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('30','58')] | /ubl-creditnote:CreditNote/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('30','58')])[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "cac:PayeeFinancialAccount",
              "phases": null
            },
            {
              "id": "DE-R-023-2",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-023-2]-If both supplier and customer are located in Germany, and if \"Payment means type code\" (BT-81) contains a code for credit transfer (30, 58), BG-18 and BG-19 shall not be provided.",
              "context": "(/ubl-invoice:Invoice/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('30','58')] | /ubl-creditnote:CreditNote/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('30','58')])[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "not(cac:CardAccount) and                     not(cac:PaymentMandate)",
              "phases": null
            },
            {
              "id": "DE-R-024-1",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-024-1]-If both supplier and customer are located in Germany, and if \"Payment means type code\" (BT-81) contains a code for payment card (48, 54, 55), \"PAYMENT CARD INFORMATION\" (BG-18) shall be provided.",
              "context": "(/ubl-invoice:Invoice/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('48','54','55')] |/ubl-creditnote:CreditNote/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('48','54','55')])[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "cac:CardAccount",
              "phases": null
            },
            {
              "id": "DE-R-024-2",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-024-2]-If both supplier and customer are located in Germany, and if \"Payment means type code\" (BT-81) contains a code for payment card (48, 54, 55), BG-17 and BG-19 shall not be provided.",
              "context": "(/ubl-invoice:Invoice/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('48','54','55')] |/ubl-creditnote:CreditNote/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('48','54','55')])[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "not(cac:PayeeFinancialAccount) and                     not(cac:PaymentMandate)",
              "phases": null
            },
            {
              "id": "DE-R-020",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "warning",
              "text": "[DE-R-020]-If both supplier and customer are located in Germany, the element \"Debited account identifier\" (BT-91) should contain a valid IBAN if code 59 SEPA is provided in \"Payment means type code\" (BT-81).",
              "context": "(/ubl-invoice:Invoice/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = '59'] | /ubl-creditnote:CreditNote/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = '59'])[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "not(normalize-space(cbc:PaymentMeansCode) = '59') or                     matches(normalize-space(replace(cac:PaymentMandate/cac:PayerFinancialAccount/cbc:ID, '([ \\n\\r\\t\\s])', '')), '^[A-Z]{2}[0-9]{2}[a-zA-Z0-9]{0,30}$') and                     xs:decimal(string-join(for $cp in string-to-codepoints(concat(substring(normalize-space(replace(cac:PaymentMandate/cac:PayerFinancialAccount/cbc:ID, '([ \\n\\r\\t\\s])', '')),5),upper-case(substring(normalize-space(replace(cac:PaymentMandate/cac:PayerFinancialAccount/cbc:ID, '([ \\n\\r\\t\\s])', '')),1,2)),substring(normalize-space(replace(cac:PaymentMandate/cac:PayerFinancialAccount/cbc:ID, '([ \\n\\r\\t\\s])', '')),3,2))) return  (if($cp > 64) then string($cp - 55) else  string($cp - 48)),'')) mod 97 = 1",
              "phases": null
            },
            {
              "id": "DE-R-025-1",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-025-1]-If both supplier and customer are located in Germany, and if \"Payment means type code\" (BT-81) contains a code for direct debit (59), \"DIRECT DEBIT\" (BG-19) shall be provided.",
              "context": "(/ubl-invoice:Invoice/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = '59'] | /ubl-creditnote:CreditNote/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = '59'])[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "cac:PaymentMandate",
              "phases": null
            },
            {
              "id": "DE-R-025-2",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-025-2]-If both supplier and customer are located in Germany, and if \"Payment means type code\" (BT-81) contains a code for direct debit (59), BG-17 and BG-18 shall not be provided.",
              "context": "(/ubl-invoice:Invoice/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = '59'] | /ubl-creditnote:CreditNote/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = '59'])[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "not(cac:PayeeFinancialAccount) and                     not(cac:CardAccount)",
              "phases": null
            },
            {
              "id": "DE-R-014",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[DE-R-014]-If both supplier and customer are located in Germany, the element \"VAT category rate\" (BT-119) shall be provided.",
              "context": "(/ubl-invoice:Invoice/cac:TaxTotal/cac:TaxSubtotal | /ubl-creditnote:CreditNote/cac:TaxTotal/cac:TaxSubtotal)[$supplierCountryIsDE and $customerCountryIsDE]",
              "test": "cac:TaxCategory/cbc:Percent[boolean(normalize-space(.))]",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-CL001",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-CL001]-Mime code must be according to subset of IANA code list.",
              "context": "cbc:EmbeddedDocumentBinaryObject[@mimeCode]",
              "test": "\n          some $code in $MIMECODE\n            satisfies @mimeCode = $code",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-CL002",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-CL002]-Reason code MUST be according to subset of UNCL 5189 D.16B.",
              "context": "cac:AllowanceCharge[cbc:ChargeIndicator = 'false']/cbc:AllowanceChargeReasonCode",
              "test": "\n          some $code in $UNCL5189\n            satisfies normalize-space(text()) = $code",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-CL003",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-CL003]-Reason code MUST be according to UNCL 7161 D.16B.",
              "context": "cac:AllowanceCharge[cbc:ChargeIndicator = 'true']/cbc:AllowanceChargeReasonCode",
              "test": "\n          some $code in $UNCL7161\n            satisfies normalize-space(text()) = $code",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-CL006",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-CL006]-Invoice period description code must be according to UNCL 2005 D.16B.",
              "context": "cac:InvoicePeriod/cbc:DescriptionCode",
              "test": "\n          some $code in $UNCL2005\n            satisfies normalize-space(text()) = $code",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-CL007",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-CL007]-Currency code must be according to ISO 4217:2005",
              "context": "cbc:Amount | cbc:BaseAmount | cbc:PriceAmount | cbc:TaxAmount | cbc:TaxableAmount | cbc:LineExtensionAmount | cbc:TaxExclusiveAmount | cbc:TaxInclusiveAmount | cbc:AllowanceTotalAmount | cbc:ChargeTotalAmount | cbc:PrepaidAmount | cbc:PayableRoundingAmount | cbc:PayableAmount",
              "test": "\n          some $code in $ISO4217\n            satisfies @currencyID = $code",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-P0100",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-P0100]-Invoice type code MUST be set according to the profile.",
              "context": "cbc:InvoiceTypeCode",
              "test": "\n          not($profile = ('01','02')) or (some $code in tokenize('71 80 82 84 102 218 219 326 331 380 382 383 384 386 388 393 395 553 575 623 780 817 870 875 876 877', '\\s')\n            satisfies normalize-space(text()) = $code)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-P0112",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-P0112]-Invoice type codes 326 and 389 are only allowed when both\n        buyer and seller are German organizations. Invoice type code 384 is only allowed when both\n        buyer and seller are German organizations or both are Slovak organizations.",
              "context": "cbc:InvoiceTypeCode",
              "test": "not(normalize-space(.) = '326' or normalize-space(.) = '384' or normalize-space(.) = '389') or ($supplierCountryIsDE and $customerCountryIsDE) or (normalize-space(.) = '384' and $supplierCountry = 'SK' and $customerCountry = 'SK')",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-P0101",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-P0101]-Credit note type code MUST be set according to the profile.",
              "context": "cbc:CreditNoteTypeCode",
              "test": "\n          not($profile = ('01','02')) or (some $code in tokenize('381 396 81 83 532', '\\s')\n            satisfies normalize-space(text()) = $code)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-F001",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-F001]-A date MUST be formatted YYYY-MM-DD.",
              "context": "cbc:IssueDate | cbc:DueDate | cbc:TaxPointDate | cbc:StartDate | cbc:EndDate | cbc:ActualDeliveryDate",
              "test": "string-length(text()) = 10 and (string(.) castable as xs:date)",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-CL008",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-CL008]-Electronic address identifier scheme must be from the codelist \"Electronic Address Identifier Scheme\"",
              "context": "cbc:EndpointID[@schemeID]",
              "test": "\n        some $code in $eaid\n        satisfies @schemeID = $code",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-P0104",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-P0104]-Tax Category G MUST be used when exemption reason code is VATEX-EU-G",
              "context": "cac:TaxCategory[upper-case(cbc:TaxExemptionReasonCode)='VATEX-EU-G']",
              "test": "normalize-space(cbc:ID)='G'",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-P0105",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-P0105]-Tax Category O MUST be used when exemption reason code is VATEX-EU-O",
              "context": "cac:TaxCategory[upper-case(cbc:TaxExemptionReasonCode)='VATEX-EU-O']",
              "test": "normalize-space(cbc:ID)='O'",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-P0106",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-P0106]-Tax Category K MUST be used when exemption reason code is VATEX-EU-IC",
              "context": "cac:TaxCategory[upper-case(cbc:TaxExemptionReasonCode)='VATEX-EU-IC']",
              "test": "normalize-space(cbc:ID)='K'",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-P0107",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-P0107]-Tax Category AE MUST be used when exemption reason code is VATEX-EU-AE",
              "context": "cac:TaxCategory[upper-case(cbc:TaxExemptionReasonCode)='VATEX-EU-AE']",
              "test": "normalize-space(cbc:ID)='AE'",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-P0108",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-P0108]-Tax Category E MUST be used when exemption reason code is VATEX-EU-D",
              "context": "cac:TaxCategory[upper-case(cbc:TaxExemptionReasonCode)='VATEX-EU-D']",
              "test": "normalize-space(cbc:ID)='E'",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-P0109",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-P0109]-Tax Category E MUST be used when exemption reason code is VATEX-EU-F",
              "context": "cac:TaxCategory[upper-case(cbc:TaxExemptionReasonCode)='VATEX-EU-F']",
              "test": "normalize-space(cbc:ID)='E'",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-P0110",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-P0110]-Tax Category E MUST be used when exemption reason code is VATEX-EU-I",
              "context": "cac:TaxCategory[upper-case(cbc:TaxExemptionReasonCode)='VATEX-EU-I']",
              "test": "normalize-space(cbc:ID)='E'",
              "phases": null
            },
            {
              "id": "PEPPOL-EN16931-P0111",
              "syntax": "UBL",
              "source": "peppol",
              "flag": "fatal",
              "text": "[PEPPOL-EN16931-P0111]-Tax Category E MUST be used when exemption reason code is VATEX-EU-J",
              "context": "cac:TaxCategory[upper-case(cbc:TaxExemptionReasonCode)='VATEX-EU-J']",
              "test": "normalize-space(cbc:ID)='E'",
              "phases": null
            }
          ]
        }
      }
    }
  ]
}
