InvoiceReferencedDocument no more than once

Error FX-SCH-A-000337 Factur-X

Element 'ram:InvoiceReferencedDocument' may occur at maximum 1 times.

Mandatory rule: As long as it is violated, the invoice is invalid and will be rejected by validators.
What is wrong

ram:SpecifiedLineTradeSettlement contains ram:InvoiceReferencedDocument more than once.

What the rule means

ram:InvoiceReferencedDocument is permitted only once within this invoice line settlement. Multiple occurrences would duplicate the reference information at this location.

Please include the invoice reference only once

ram:InvoiceReferencedDocument appears more than once in the settlement for an invoice line. You can reduce this to a single occurrence.

What to do
  1. Locate ram:InvoiceReferencedDocument within ram:SpecifiedLineTradeSettlement for the affected invoice line.
  2. Keep no more than one ram:InvoiceReferencedDocument element there.
  3. Generate the invoice again and check it once more.
What it looks like
✗ Triggers the message
<ram:SpecifiedLineTradeSettlement>
  <ram:InvoiceReferencedDocument/>
  <ram:InvoiceReferencedDocument/>
</ram:SpecifiedLineTradeSettlement>
✓ Correct
<ram:SpecifiedLineTradeSettlement>
  <ram:InvoiceReferencedDocument/>
</ram:SpecifiedLineTradeSettlement>
Technical details

The test counts direct ram:InvoiceReferencedDocument elements within ram:SpecifiedLineTradeSettlement and permits no more than one.

Where the rule applies

The rule applies within ram:SpecifiedLineTradeSettlement on an invoice line.

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