Exactly one CountryID in the legal organization’s address

Error FX-SCH-A-000878 Factur-X

Element 'ram:CountryID' 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

CountryID is missing from PostalTradeAddress or occurs more than once. It must be present exactly once.

What the rule means

The rule requires exactly one country identifier in the postal address of the invoicee’s legal organization.

Please specify exactly one country in the invoicee’s legal organization address

CountryID is missing or appears more than once in the invoicee’s legal organization address. The address must contain exactly one such element.

What to do
  1. Find PostalTradeAddress under the invoicee’s SpecifiedLegalOrganization.
  2. Check how many times CountryID occurs in it.
  3. Add exactly one CountryID element or remove any duplicates.
  4. Generate the invoice again and validate it again.
What it looks like
✗ Triggers the message
<ram:PostalTradeAddress/>
✓ Correct
<ram:PostalTradeAddress>
  <ram:CountryID>XX</ram:CountryID>
</ram:PostalTradeAddress>
Technical details

Within PostalTradeAddress, the number of direct CountryID elements is checked; the test passes only when there is exactly one.

Where the rule applies

The rule applies to the postal address of the invoicee’s SpecifiedLegalOrganization.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ ram:InvoiceeTradeParty/ram:SpecifiedLegalOrganization/ram:PostalTradeAddress
Test expression (assert/@test)
count(ram:CountryID)=1