VRBL-INV-MX-1p0-5

Basic Info

Rule The value of the Invoice Line Commodity Classification Code List ID must be contained in UNCL7143 item type identification [VRBL-CL-ItemNumberTypeCode] or be contained in Item Number Type Code [VRBL-CL-MX-ItemNumberTypeCode] (prefixed by 'VRBL:MX:'). For more information visit: https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL7143/
Context /ubl:Invoice/cac:InvoiceLine/cac:Item/cac:CommodityClassification/cbc:ItemClassificationCode
Pattern vrbl-invoice-mx-1p0
Severity fatal

Used Template: CodeList

Parameter Value
probe = @listID
codeList = $VRBL-CL-ItemNumberTypeCode or $VRBL-MX-Prefix:$VRBL-CL-MX-ItemNumberTypeCode

Implementation

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