Document type must occur exactly once

Error FX-SCH-A-000616 Factur-X

Element 'ram:TypeCode' 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:TypeCode does not occur exactly once in ram:AdditionalReferencedDocument. The element is missing or appears more than once.

What the rule means

ram:TypeCode identifies the type of the additional referenced document. Exactly one element ensures that this information is provided once.

Please include the document type exactly once

The additional referenced document is missing its document type, or the type is entered more than once. You can correct the number of entries.

What to do
  1. Locate the relevant ram:AdditionalReferencedDocument.
  2. Make sure it contains exactly one ram:TypeCode.
  3. Generate the invoice again and validate it once more.
What it looks like
✗ Triggers the message
<ram:AdditionalReferencedDocument/>
✓ Correct
<ram:AdditionalReferencedDocument>
  <ram:TypeCode>x</ram:TypeCode>
</ram:AdditionalReferencedDocument>
Technical details

The XPath test checks whether exactly one direct ram:TypeCode element is present.

Where the rule applies

The rule applies to ram:TypeCode in ram:AdditionalReferencedDocument in a line item's settlement information.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ ram:SpecifiedLineTradeSettlement/ram:AdditionalReferencedDocument
Test expression (assert/@test)
count(ram:TypeCode)=1