One ram:CategoryCode for the charge tax category

Error FX-SCH-A-000481 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 element ram:CategoryCode does not occur exactly once in ram:CategoryTradeTax. It is either missing or occurs more than once.

What the rule means

Exactly one ram:CategoryCode unambiguously specifies the VAT category of the charge.

Please provide exactly one `ram:CategoryCode` in `ram:CategoryTradeTax`

ram:CategoryTradeTax for the charge is missing ram:CategoryCode, or the element occurs more than once. The rule requires exactly one.

What to do
  1. Locate ram:CategoryTradeTax in the charge.
  2. Ensure that ram:CategoryCode occurs exactly once in it.
  3. Generate the invoice again and validate it.
What it looks like
✗ Triggers the message
<ram:CategoryTradeTax>
  <ram:TypeCode>VAT</ram:TypeCode>
</ram:CategoryTradeTax>
✓ Correct
<ram:CategoryTradeTax>
  <ram:CategoryCode>S</ram:CategoryCode>
</ram:CategoryTradeTax>
Technical details

The test counts direct ram:CategoryCode children of ram:CategoryTradeTax and requires exactly one.

Where the rule applies

The rule applies to ram:CategoryTradeTax of a document-level charge.

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