VRBL-INV-US-DBNA-1p0-52

Basic Info

Rule The value of the Item Price Base Quantity Unit of Measure Code must be contained in X12 Unit Code [VRBL-CL-X12-UnitCode] (prefixed by 'VRBL:X12:').
Context /ubl:Invoice/cac:InvoiceLine/cac:Price/cbc:BaseQuantity
Pattern vrbl-invoice-us-dbna-1p0
Severity fatal

Used Template: CodeList

Parameter Value
probe = @unitCode
codeList = $VRBL-X12-Prefix:$VRBL-CL-X12-UnitCode
showValues = false

Implementation

not(boolean(@unitCode))
or
(
	(
		substring(normalize-space(@unitCode), 1, string-length($VRBL-X12-Prefix)) = $VRBL-X12-Prefix
		and
		not(
			contains(
				substring-after(normalize-space(@unitCode), $VRBL-X12-Prefix),
				substring($VRBL-CL-X12-UnitCode, 1, 1)
			)
		)
		and
		contains(
			$VRBL-CL-X12-UnitCode,
			concat(
				substring($VRBL-CL-X12-UnitCode, 1, 1),
				substring-after(normalize-space(@unitCode), $VRBL-X12-Prefix),
				substring($VRBL-CL-X12-UnitCode, 1, 1)
			)
		)
	)
)