VRBL-DPA-MX-1p0-60

Basic Info

Rule When Dispatch Line Item Commodity Classification Code List ID is 'VRBL:MX:ProcessingStage', the value of the Dispatch Line Item Commodity Classification Code must be contained in Processing Stage Code [VRBL-CL-MX-ProcessingStage] (prefixed by 'VRBL:MX:'). Allowed values: VRBL:MX:01, VRBL:MX:02, VRBL:MX:03, VRBL:MX:04, VRBL:MX:05.
Context /ubl:DespatchAdvice/cac:DespatchLine/cac:Item/cac:CommodityClassification/cbc:ItemClassificationCode
Pattern vrbl-despatchadvice-mx-1p0
Severity fatal

Used Template: CodeList

Parameter Value
probe = .
codeList = $VRBL-MX-Prefix:$VRBL-CL-MX-ProcessingStage
showValues = true

Implementation

(
	not(@listID = concat($VRBL-MX-Prefix, 'ProcessingStage'))
)
or
(
	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-ProcessingStage, 1, 1)
				)
			)
			and
			contains(
				$VRBL-CL-MX-ProcessingStage,
				concat(
					substring($VRBL-CL-MX-ProcessingStage, 1, 1),
					substring-after(normalize-space(.), $VRBL-MX-Prefix),
					substring($VRBL-CL-MX-ProcessingStage, 1, 1)
				)
			)
		)
	)
)