Provide the document type code exactly once

Error FX-SCH-A-000558 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 the applicable AdditionalReferencedDocument. It is either missing or appears more than once.

What the rule means

ram:TypeCode specifies the type of the referenced document. Exactly one such code is required for the document being checked.

Please provide document type code `130` exactly once

ram:TypeCode does not occur exactly once in the referenced document. For this rule, document type code 130 must be stated unambiguously.

What to do
  1. Check AdditionalReferencedDocument in ApplicableHeaderTradeAgreement.
  2. Make sure it contains exactly one ram:TypeCode with the value 130.
  3. Generate the invoice again and validate it.
What it looks like
✗ Triggers the message
<ram:AdditionalReferencedDocument>
  <ram:TypeCode>130</ram:TypeCode>
  <ram:TypeCode>130</ram:TypeCode>
</ram:AdditionalReferencedDocument>
✓ Correct
<ram:AdditionalReferencedDocument>
  <ram:TypeCode>130</ram:TypeCode>
</ram:AdditionalReferencedDocument>
Technical details

For AdditionalReferencedDocument with ram:TypeCode equal to 130, the test checks that exactly one direct ram:TypeCode element is present.

Where the rule applies

The rule applies to ram:TypeCode in AdditionalReferencedDocument within ApplicableHeaderTradeAgreement when the code has the value 130.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ ram:AdditionalReferencedDocument[ram:TypeCode="130"]
Test expression (assert/@test)
count(ram:TypeCode)=1