Country identifier required for the ship-to address

Error FX-SCH-A-000455 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

ram:CountryID does not occur exactly once in ram:PostalTradeAddress. The element is either missing or appears more than once.

What the rule means

The country identifier assigns the ship-to address to a country. It must be supplied exactly once in the postal address.

Please provide the ship-to address country identifier exactly once

ram:CountryID is missing from the ship-to postal address or appears more than once. You can adjust the number of occurrences in the address.

What to do
  1. Add ram:CountryID to ram:PostalTradeAddress if it is missing.
  2. Remove any extra ram:CountryID elements so that exactly one remains.
  3. Generate the invoice again and validate it.
What it looks like
✗ Triggers the message
<ram:PostalTradeAddress/>
✓ Correct
<ram:PostalTradeAddress>
  <ram:CountryID>DE</ram:CountryID>
</ram:PostalTradeAddress>
Technical details

The rule counts the direct ram:CountryID elements under ram:PostalTradeAddress and requires exactly one.

Where the rule applies

The rule applies to the ship-to party’s postal address, ram:PostalTradeAddress.

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