VRBL-INV-NO-1p0-1

Basic Info

Rule When the Seller Group is Norwegian, the Seller Tax ID must be the NO country code prefix, followed by a valid Norwegian organization number (nine numbers), followed by the suffix MVA. For example: NO123456789MVA.
Context /ubl:Invoice/cac:AccountingSupplierParty
Pattern vrbl-invoice-no-1p0
Severity fatal

Implementation

not($NOSupplierCountry = 'NO')
or
(
	substring(cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/cbc:CompanyID, 1, 2) = 'NO'
	and
	string-length(translate(substring(normalize-space(cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/cbc:CompanyID), 3, 9), $Numerics, '')) = 0
	and
	contains(substring(cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/cbc:CompanyID, 12, 3), 'MVA')
)