Address country identifier required

Error FX-SCH-A-000682 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:PostalTradeAddress does not contain exactly one ram:CountryID element. The element is missing or occurs more than once.

What the rule means

ram:CountryID is the required country identifier for the tax representative’s postal address.

Please provide exactly one country identifier for the tax representative’s address

The tax representative’s postal address is missing ram:CountryID, or the element is present more than once. You can correct this by including exactly one element.

What to do
  1. Find ram:PostalTradeAddress for the buyer’s tax representative.
  2. Make sure it contains exactly one ram:CountryID element.
  3. Generate the invoice again and validate it once more.
What it looks like
✗ Triggers the message
<ram:PostalTradeAddress/>
✓ Correct
<ram:PostalTradeAddress>
  <ram:CountryID/>
</ram:PostalTradeAddress>
Technical details

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

Where the rule applies

The rule applies to the postal address of the buyer’s tax representative.

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