ram:ID must occur exactly once

Error FX-SCH-A-000019 Factur-X

Element 'ram:ID' 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:ID does not occur exactly once in rsm:ExchangedDocument. The element is either missing or present more than once.

What the rule means

ram:ID contains the document identifier and must occur exactly once in the document header.

Please include the document identifier exactly once

ram:ID is missing from the document header or occurs more than once. Adjust the number of occurrences so the element appears exactly once.

What to do
  1. Make sure rsm:ExchangedDocument contains exactly one direct ram:ID element.
  2. Generate the invoice again and validate it once more.
What it looks like
✗ Triggers the message
<rsm:ExchangedDocument>
  <ram:ID>INV-1</ram:ID>
  <ram:ID>INV-2</ram:ID>
</rsm:ExchangedDocument>
✓ Correct
<rsm:ExchangedDocument>
  <ram:ID>INV-1</ram:ID>
</rsm:ExchangedDocument>
Technical details

The XPath test counts the direct ram:ID elements in rsm:ExchangedDocument and requires the count to be 1.

Where the rule applies

The rule applies within the document header, rsm:ExchangedDocument.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:ExchangedDocument
Test expression (assert/@test)
count(ram:ID)=1