Include CountryID exactly once

Error FX-SCH-A-000686 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 is missing from this postal address or occurs more than once.

What the rule means

The rule requires exactly one country identifier for this postal address.

Please include exactly one country identifier for the postal address

ram:CountryID is missing or repeated in the postal address of the buyer’s tax representative’s legal organization. You can adjust the entry so that exactly one element is present.

What to do
  1. Look for ram:CountryID in the ram:PostalTradeAddress of ram:SpecifiedLegalOrganization.
  2. Add the element if it is missing, or remove duplicates 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>XX</ram:CountryID>
</ram:PostalTradeAddress>
Technical details

The XPath context is ram:PostalTradeAddress; the check requires exactly one direct ram:CountryID element.

Where the rule applies

The rule applies to the postal address within the buyer’s tax representative’s ram:SpecifiedLegalOrganization.

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