[ibr-055-ae]-Preceding invoice reference (IBG-03) is must when invoice type code (IBT-003) is 381 (Credit note) or 81 (Credit note related to goods or services) except when the [BTAE-03] Credit note reason code is 'VD'.
ibr-055-ae
/ubl:Invoice | /cn:CreditNote
((cbc:InvoiceTypeCode = "381" or cbc:InvoiceTypeCode = "81") and (((cac:BillingReference) and (cac:DiscrepancyResponse/cbc:ResponseCode != "VD")) or (not(cac:BillingReference) and (cac:DiscrepancyResponse/cbc:ResponseCode = "VD")))) or not(cbc:InvoiceTypeCode = "381" or cbc:InvoiceTypeCode = "81")