VRBL-INV-PL-B2B-3-92

Basic Info

Rule The second segment of the Invoice Document Reference UUID must be a valid date, formated like YYYYMMDD.
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(substring-after(., '-'), '-'))=8      and translate(substring-before(substring-after(., '-'), '-'), $Numerics, '')=''      and substring(substring-before(substring-after(., '-'), '-'), 1, 4) >= '2020'      and substring(substring-before(substring-after(., '-'), '-'), 5, 2) >= '01'      and substring(substring-before(substring-after(., '-'), '-'), 5, 2) <= '12'      and substring(substring-before(substring-after(., '-'), '-'), 7, 2) >= '01'      and substring(substring-before(substring-after(., '-'), '-'), 7, 2) <= '31'     )