VRBL-INV-MX-1p0-67

Basic Info

Rule When used as Customs Declaration Number, the value of the Additional Document Reference ID (5th to 6th character) must be contained in Customs code [VRBL-CL-MX-CustomsCode].
Context /ubl:Invoice/cac:AdditionalDocumentReference/cbc:ID
Pattern vrbl-invoice-mx-1p0
Severity fatal

Used Template: CodeList

Parameter Value
probe = substring(., 5, 2)
displayName_probe = %{.} (5th to 6th character)
codeList = $VRBL-CL-MX-CustomsCode

Implementation

(
	not(@schemeID = 'ABT')
)
or
(
	not(boolean(substring(., 5, 2)))
	or
	(
		(
			not(
				contains(
					normalize-space(substring(., 5, 2)),
					substring($VRBL-CL-MX-CustomsCode, 1, 1)
				)
			)
			and
			contains(
				$VRBL-CL-MX-CustomsCode,
				concat(
					substring($VRBL-CL-MX-CustomsCode, 1, 1),
					normalize-space(substring(., 5, 2)),
					substring($VRBL-CL-MX-CustomsCode, 1, 1)
				)
			)
		)
	)
)