VRBL-INV-IT-1p2-101

Basic Info

Rule When the Buyer Country Identification Code is 'IT', the value of the Buyer Country Subentity must be contained in ISO 3166-2:IT [VRBL-CL-IT-ProvinceStateCode].
Context /ubl:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cbc:CountrySubentity
Pattern vrbl-invoice-it-1p2
Severity fatal

Used Template: CodeList

Parameter Value
probe = .
codeList = $VRBL-CL-IT-ProvinceStateCode

Implementation

(
	not(../cac:Country/cbc:IdentificationCode = 'IT')
)
or
(
	not(boolean(.))
	or
	(
		(
			not(
				contains(
					normalize-space(.),
					substring($VRBL-CL-IT-ProvinceStateCode, 1, 1)
				)
			)
			and
			contains(
				$VRBL-CL-IT-ProvinceStateCode,
				concat(
					substring($VRBL-CL-IT-ProvinceStateCode, 1, 1),
					normalize-space(.),
					substring($VRBL-CL-IT-ProvinceStateCode, 1, 1)
				)
			)
		)
	)
)