BR-NL-8
The rule sets below word this rule differently; each wording is shown with its rule set.
What the rule checks
As the rule set's publisher wrote it. The rule runs on every element the context matches, and fails where the test is false; the validator reports the line of that element.
If the invoice type code (cbc:InvoiceTypeCode) is 381, the document MUST use the CreditNote scheme
cbc:InvoiceTypeCode[$s]|cbc:CreditNoteTypeCode[$s]
(. != '381') or /cn:CreditNote
Checked with Netherlands SI-UBL 2.0 Invoice (NLCIUS), Netherlands SI-UBL 2.0 Credit Note (NLCIUS)
If the credit note type code (cbc:CreditNoteTypeCode) is 380, 384 or 389, the document MUST use the Invoice scheme
cbc:InvoiceTypeCode[$s]|cbc:CreditNoteTypeCode[$s]
(. = '381') or /ubl:Invoice
Checked with Netherlands SI-UBL 2.0 Invoice (NLCIUS), Netherlands SI-UBL 2.0 Credit Note (NLCIUS)