VRBL-INV-SE-1p0-1

Basic Info

Rule If the Seller Group is Swedish, then the Seller Tax ID used for VAT ID must be 14 characters long.
Context /ubl:Invoice/cac:AccountingSupplierParty
Pattern vrbl-invoice-se-1p0
Severity fatal

Implementation

not(boolean(cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/cbc:CompanyID))
or
not(
	cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'SE'
	and
	substring(cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/cbc:CompanyID, 1, 2) = 'SE'
)
or
string-length(normalize-space(cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/cbc:CompanyID)) = 14