VRBL-INV-PT-SAF-T-1p0-21

Basic Info

Rule The value of the Dispatch Location Extension Warehouse Party Identification Scheme ID must be contained in PT SAF-T Despatch Location Type Code List [VRBL-CL-PT-DespatchLocationTypeCode] (prefixed by 'VRBL:PT:').
Context /ubl:Invoice/cac:Delivery/cac:Despatch/cac:DespatchLocation/cec:UBLExtensions/cec:UBLExtension/cec:ExtensionContent/vrbl:DespatchLocationExtension/cac:WarehouseParty/cac:PartyIdentification/cbc:ID
Pattern vrbl-invoice-pt-saft-1p0
Severity fatal

Used Template: CodeList

Parameter Value
probe = @schemeID
codeList = $VRBL-PT-Prefix:$VRBL-CL-PT-DespatchLocationTypeCode

Implementation

not(boolean(@schemeID))
or
(
	(
		substring(normalize-space(@schemeID), 1, string-length($VRBL-PT-Prefix)) = $VRBL-PT-Prefix
		and
		not(
			contains(
				substring-after(normalize-space(@schemeID), $VRBL-PT-Prefix),
				substring($VRBL-CL-PT-DespatchLocationTypeCode, 1, 1)
			)
		)
		and
		contains(
			$VRBL-CL-PT-DespatchLocationTypeCode,
			concat(
				substring($VRBL-CL-PT-DespatchLocationTypeCode, 1, 1),
				substring-after(normalize-space(@schemeID), $VRBL-PT-Prefix),
				substring($VRBL-CL-PT-DespatchLocationTypeCode, 1, 1)
			)
		)
	)
)