VRBL-INV-CH-YELLOWBILL-3p0-41

Basic Info

Rule The value of the Invoice Line Delivery Quantity Unit Code must be contained in Subset of UNECE Recommendation 20 unit of measure codes applicable for Switzerland [VRBL-CL-CH-UnitOfMeasure-UNECE-Rec20] or be contained in Subset of UNECE Recommendation 21 unit of measure codes applicable for Switzerland, prefixed by X [VRBL-CL-CH-UnitOfMeasure-UNECE-Rec21] or be contained in Extended values for Unit of Measure applicable for Switzerland [VRBL-CL-CH-UnitOfMeasure-Extension] (prefixed by 'VRBL:CH:').
Context /ubl:Invoice/cac:InvoiceLine/cac:Delivery/cbc:Quantity
Pattern vrbl-ch-yellowbill-3p0
Severity fatal

Used Template: CodeList

Parameter Value
probe = @unitCode
codeList = $VRBL-CL-CH-UnitOfMeasure-UNECE-Rec20 or $VRBL-CL-CH-UnitOfMeasure-UNECE-Rec21 or $VRBL-CH-Prefix:$VRBL-CL-CH-UnitOfMeasure-Extension

Implementation

not(boolean(@unitCode))
or
(
	(
		not(
			contains(
				normalize-space(@unitCode),
				substring($VRBL-CL-CH-UnitOfMeasure-UNECE-Rec20, 1, 1)
			)
		)
		and
		contains(
			$VRBL-CL-CH-UnitOfMeasure-UNECE-Rec20,
			concat(
				substring($VRBL-CL-CH-UnitOfMeasure-UNECE-Rec20, 1, 1),
				normalize-space(@unitCode),
				substring($VRBL-CL-CH-UnitOfMeasure-UNECE-Rec20, 1, 1)
			)
		)
	)
)
or
(
	(
		not(
			contains(
				normalize-space(@unitCode),
				substring($VRBL-CL-CH-UnitOfMeasure-UNECE-Rec21, 1, 1)
			)
		)
		and
		contains(
			$VRBL-CL-CH-UnitOfMeasure-UNECE-Rec21,
			concat(
				substring($VRBL-CL-CH-UnitOfMeasure-UNECE-Rec21, 1, 1),
				normalize-space(@unitCode),
				substring($VRBL-CL-CH-UnitOfMeasure-UNECE-Rec21, 1, 1)
			)
		)
	)
)
or
(
	(
		substring(normalize-space(@unitCode), 1, string-length($VRBL-CH-Prefix)) = $VRBL-CH-Prefix
		and
		not(
			contains(
				substring-after(normalize-space(@unitCode), $VRBL-CH-Prefix),
				substring($VRBL-CL-CH-UnitOfMeasure-Extension, 1, 1)
			)
		)
		and
		contains(
			$VRBL-CL-CH-UnitOfMeasure-Extension,
			concat(
				substring($VRBL-CL-CH-UnitOfMeasure-Extension, 1, 1),
				substring-after(normalize-space(@unitCode), $VRBL-CH-Prefix),
				substring($VRBL-CL-CH-UnitOfMeasure-Extension, 1, 1)
			)
		)
	)
)