VRBL-INV-IT-1p2-102

Basic Info

Rule The Buyer Tax Company ID used as VAT ID must begin with a valid Alpha-2 Country Code, or 'EL' when the customer country code is 'GR'.
Context /ubl:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID
Pattern vrbl-invoice-it-1p2
Severity fatal

Implementation

not(../cac:TaxScheme/cbc:ID = 'VAT')
or
contains($VRBL-CL-CountryCode, concat(' ', substring(normalize-space(.), 1, 2), ' '))
or
(
substring(normalize-space(.), 1, 2) = 'EL' 
and 
../../cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'GR'
)