Message

When specifying non-VAT Taxes for Danish customers, Danish suppliers MUST use the AllowanceChargeReasonCode="ZZZ" and the 4-digit Tax category MUST be specified in AllowanceChargeReason

Context
cac:AllowanceCharge[$DKSupplierCountry = 'DK' and $DKCustomerCountry = 'DK']
Test
not((cbc:AllowanceChargeReasonCode = 'ZZZ') and not((string-length(normalize-space(cbc:AllowanceChargeReason/text())) = 4) and (number(cbc:AllowanceChargeReason) >= 0) and (number(cbc:AllowanceChargeReason) <= 9999)) )
Usage
/ ubl:Invoice / cac:AllowanceCharge / cbc:AllowanceChargeReasonCode
/ ubl:Invoice / cac:AllowanceCharge / cbc:AllowanceChargeReason
/ ubl:Invoice / cac:InvoiceLine / cac:AllowanceCharge / cbc:AllowanceChargeReasonCode
/ ubl:Invoice / cac:InvoiceLine / cac:AllowanceCharge / cbc:AllowanceChargeReason
/ ubl:CreditNote / cac:AllowanceCharge / cbc:AllowanceChargeReasonCode
/ ubl:CreditNote / cac:AllowanceCharge / cbc:AllowanceChargeReason
/ ubl:CreditNote / cac:CreditNoteLine / cac:AllowanceCharge / cbc:AllowanceChargeReasonCode
/ ubl:CreditNote / cac:CreditNoteLine / cac:AllowanceCharge / cbc:AllowanceChargeReason