VRBL-INV-ES-B2G-2

Basic Info

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

Used Template: CodeList

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

Implementation

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