Provide exactly one country for the delivery address

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

The element ram:PostalTradeAddress does not contain exactly one ram:CountryID. It is either missing or occurs more than once.

What the rule means

ram:CountryID specifies the country of the delivery address. The postal address must contain exactly one such country value.

Please provide exactly one country for the delivery address

The delivery recipient’s postal address does not contain exactly one ram:CountryID. You can adjust the country value in the address.

What to do
  1. Locate ram:CountryID under ram:PostalTradeAddress of ram:ShipToTradeParty.
  2. Make sure exactly one ram:CountryID is present.
  3. Generate the invoice again and validate it once more.
What it looks like
✗ Triggers the message
<ram:PostalTradeAddress/>
✓ Correct
<ram:PostalTradeAddress>
  <ram:CountryID>DE</ram:CountryID>
</ram:PostalTradeAddress>
Technical details

The XPath condition checks whether the number of child elements named ram:CountryID is exactly one.

Where the rule applies

The rule applies to the postal address of the delivery recipient under ShipToTradeParty for an invoice line.

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