Exactly one country in the ship-from organization address

Error FX-SCH-A-000807 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 postal address requires exactly one country entry so that the country of the ship-from organization is unambiguous.

Please provide exactly one country in the ship-from organization address

ram:CountryID is missing or appears more than once in the ship-from organization’s ram:PostalTradeAddress. The number of elements can be adjusted to exactly one.

What to do
  1. Locate ram:PostalTradeAddress in ram:SpecifiedLegalOrganization for the ship-from party.
  2. Ensure that it contains exactly one ram:CountryID element.
  3. Regenerate the invoice and validate it again.
What it looks like
✗ Triggers the message
<ram:PostalTradeAddress/>
✓ Correct
<ram:PostalTradeAddress>
  <ram:CountryID>DE</ram:CountryID>
</ram:PostalTradeAddress>
Technical details

The rule checks that the number of direct ram:CountryID child elements of ram:PostalTradeAddress equals one.

Where the rule applies

This rule applies to ram:PostalTradeAddress within ram:SpecifiedLegalOrganization for the ship-from party (ram:ShipFromTradeParty).

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