VRBL-DPA-MX-1p0-51

Basic Info

Rule The value of the Shipment Dispatch Location Country Subentity Code must be contained in Country Subentity Code [VRBL-CL-MX-CountrySubentityCode] (prefixed by 'VRBL:MX:').
Context /ubl:DespatchAdvice/cac:Shipment/cac:Delivery/cac:Despatch/cac:DespatchLocation/cac:Address/cbc:CountrySubentityCode
Pattern vrbl-despatchadvice-mx-1p0
Severity fatal

Used Template: CodeList

Parameter Value
probe = .
codeList = $VRBL-MX-Prefix:$VRBL-CL-MX-CountrySubentityCode
showValues = false

Implementation

not(boolean(.))
or
(
	(
		substring(normalize-space(.), 1, string-length($VRBL-MX-Prefix)) = $VRBL-MX-Prefix
		and
		not(
			contains(
				substring-after(normalize-space(.), $VRBL-MX-Prefix),
				substring($VRBL-CL-MX-CountrySubentityCode, 1, 1)
			)
		)
		and
		contains(
			$VRBL-CL-MX-CountrySubentityCode,
			concat(
				substring($VRBL-CL-MX-CountrySubentityCode, 1, 1),
				substring-after(normalize-space(.), $VRBL-MX-Prefix),
				substring($VRBL-CL-MX-CountrySubentityCode, 1, 1)
			)
		)
	)
)