VRBL-INV-PL-B2B-3-91

Basic Info

Rule The first segment of the Invoice Document Reference UUID must be a valid identifier, with a format like 9999999999, M123456789 or ABC1234567.
Context /ubl:Invoice/cac:BillingReference/cac:InvoiceDocumentReference/cbc:UUID
Pattern vrbl-invoice-pl-b2b-3p0
Severity fatal

Implementation

not(string-length(.)>=35 and string-length(.)<=36) or
not(string-length(translate(., '-', '')) = string-length(.) - 3 or string-length(translate(., '-', '')) = string-length(.) - 4) or 
(string-length(substring-before(., '-'))=10 and
  (translate(substring(., 1, 1), '1234567890', '')='' and translate(substring(., 2, 9), $Numerics, '')='')
  or
  (substring(., 1, 1)='M' and translate(substring(., 2, 9), $Numerics, '')='')
  or
  (translate(substring(., 1, 3), $AlphabetUpperCase, '')='' and translate(substring(., 4, 7), $Numerics, '')='')
)