VRBL-INV-TW-TX-B2C-1p0-17

Basic Info

Rule The value of the Invoice Document Reference Correction Method must be contained in Correction Method Code [VRBL-CL-TW-CorrectionMethod] (prefixed by 'VRBL:TW:').
Context /ubl:Invoice/cac:BillingReference/cac:InvoiceDocumentReference/cec:UBLExtensions/cec:UBLExtension/cec:ExtensionContent/vrbl:InvoiceDocumentReferenceExtension/vrbl:CorrectionData/vrbl:CorrectionMethod
Pattern vrbl-invoice-tw-tx-b2c-1p0
Severity fatal

Used Template: CodeList

Parameter Value
probe = .
codeList = $VRBL-TW-Prefix:$VRBL-CL-TW-CorrectionMethod

Implementation

not(boolean(.))
or
(
	(
		substring(normalize-space(.), 1, string-length($VRBL-TW-Prefix)) = $VRBL-TW-Prefix
		and
		not(
			contains(
				substring-after(normalize-space(.), $VRBL-TW-Prefix),
				substring($VRBL-CL-TW-CorrectionMethod, 1, 1)
			)
		)
		and
		contains(
			$VRBL-CL-TW-CorrectionMethod,
			concat(
				substring($VRBL-CL-TW-CorrectionMethod, 1, 1),
				substring-after(normalize-space(.), $VRBL-TW-Prefix),
				substring($VRBL-CL-TW-CorrectionMethod, 1, 1)
			)
		)
	)
)