Allowance tax requires exactly one tax category code

Error FX-SCH-A-000474 Factur-X

Element 'ram:CategoryCode' must occur exactly 1 times.

Mandatory rule: As long as it is violated, the invoice is invalid and will be rejected by validators.
What is wrong

The allowance’s tax information does not contain ram:CategoryCode exactly once. It is missing or occurs more than once.

What the rule means

The tax category code identifies the tax category of the allowance. Exactly one such code makes the classification unambiguous.

Please provide exactly one tax category code for the allowance

The allowance’s tax information is missing a tax category code or contains it more than once. Providing it once makes the category clear.

What to do
  1. Locate the allowance’s ram:CategoryTradeTax tax information.
  2. Make sure it contains exactly one ram:CategoryCode element.
  3. Generate the invoice again and validate it again.
What it looks like
✗ Triggers the message
<ram:CategoryTradeTax/>
✓ Correct
<ram:CategoryTradeTax>
  <ram:CategoryCode/>
</ram:CategoryTradeTax>
Technical details

The test counts the direct child elements ram:CategoryCode within ram:CategoryTradeTax and requires a count of 1.

Where the rule applies

The rule applies to the ram:CategoryTradeTax tax information of a document-level allowance in ram:SpecifiedTradeAllowanceCharge.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator="false"]/ ram:CategoryTradeTax
Test expression (assert/@test)
count(ram:CategoryCode)=1