BR-NL-9
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.
For suppliers in the Netherlands, if the document is a corrective invoice (cbc:InvoiceTypeCode = 384), the document MUST contain an invoice reference (cac:BillingReference/cac:InvoiceDocumentReference/cbc:ID)
cbc:InvoiceTypeCode[$s]|cbc:CreditNoteTypeCode[$s]
(. != '384') or /*/cac:BillingReference/cac:InvoiceDocumentReference/cbc:ID
Checked with Netherlands SI-UBL 2.0 Invoice (NLCIUS), Netherlands SI-UBL 2.0 Credit Note (NLCIUS)
For suppliers in the Netherlands, if the document is a corrective invoice (rsm:ExchangedDocument/ram:TypeCode = 384), the document MUST contain an invoice reference (/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:InvoiceReferencedDocument/ram:IssuerAssignedID)
/*/rsm:ExchangedDocument/ram:TypeCode[$si]
not($s) or (. != 384) or ../rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:InvoiceReferencedDocument/ram:IssuerAssignedID
Checked with Netherlands NLCIUS Invoice (CII)