VRBL-INV-PL-B2B-3-95

Basic Info

Rule The Seller Party Identification Group used for TAX ID must follow the pattern of a NIP.
Context /ubl:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PartyIdentification/cbc:ID
Pattern vrbl-invoice-pl-b2b-3p0
Severity fatal

Implementation

not(@schemeID = concat($VRBL-PL-Prefix, 'TAX'))
or
(
	(
		string-length(translate(., '-', ''))
		=
		10
	)
	and
	(
		translate(
			substring(translate(., '-', ''), 1, 1),
			'123456789',
			''
		)
		=
		''
	)
	and
	(
		(
			(
				translate(
					substring(translate(., '-', ''), 2, 1),
					'0123456789',
					''
				)
				=
				''
			)
			and
			(
				translate(
					substring(translate(., '-', ''), 3, 1),
					'123456789',
					''
				)
				=
				''
			)
		)
		or
		(
			(
				translate(
					substring(translate(., '-', ''), 2, 1),
					'123456789',
					''
				)
				=
				''
			)
			and
			(
				translate(
					substring(translate(., '-', ''), 3, 1),
					'0123456789',
					''
				)
				=
				''
			)
		)
	)
	and
	(
		translate(
			substring(translate(., '-', ''), 4, 7),
			'0123456789',
			''
		)
		=
		''
	)
)