VRBL-INV-PH-1p0-5

Basic Info

Rule The value of the Invoice Type Code must be contained in Invoice Type Code for Philippines [VRBL-CL-PH-InvoiceTypeCode] (prefixed by 'VRBL:PH:').
Context /ubl:Invoice
Pattern vrbl-invoice-ph-1p0
Severity fatal

Used Template: CodeList

Parameter Value
probe = cbc:InvoiceTypeCode
codeList = $VRBL-PH-Prefix:$VRBL-CL-PH-InvoiceTypeCode

Implementation

not(boolean(cbc:InvoiceTypeCode))
or
(
	(
		substring(normalize-space(cbc:InvoiceTypeCode), 1, string-length($VRBL-PH-Prefix)) = $VRBL-PH-Prefix
		and
		not(
			contains(
				substring-after(normalize-space(cbc:InvoiceTypeCode), $VRBL-PH-Prefix),
				substring($VRBL-CL-PH-InvoiceTypeCode, 1, 1)
			)
		)
		and
		contains(
			$VRBL-CL-PH-InvoiceTypeCode,
			concat(
				substring($VRBL-CL-PH-InvoiceTypeCode, 1, 1),
				substring-after(normalize-space(cbc:InvoiceTypeCode), $VRBL-PH-Prefix),
				substring($VRBL-CL-PH-InvoiceTypeCode, 1, 1)
			)
		)
	)
)