At most one additional reference document of type 130 per invoice line

Warning CII-SR-474 Syntax (UBL/CII)

- An invoice line shall not contain more than one AdditionalReferencedDocument with TypeCode 130.

Recommendation: The invoice remains valid but should be corrected so that it can be processed automatically.
What is wrong

Multiple ram:AdditionalReferencedDocument elements in ram:SpecifiedLineTradeSettlement have the value 130 in ram:TypeCode.

What the rule means

A reference document of type 130 may be associated with an invoice line no more than once.

Please use no more than one type `130` reference document per invoice line

An invoice line contains more than one additional reference document with ram:TypeCode 130. You can resolve this by adjusting the repeated references.

What to do
  1. Find the ram:AdditionalReferencedDocument elements with ram:TypeCode 130 in ram:SpecifiedLineTradeSettlement.
  2. Keep no more than one of these reference documents for the invoice line.
  3. Generate the invoice again and validate it.
What it looks like
✗ Triggers the message
<ram:SpecifiedLineTradeSettlement>
  <ram:AdditionalReferencedDocument>
    <ram:TypeCode>130</ram:TypeCode>
  </ram:AdditionalReferencedDocument>
  <ram:AdditionalReferencedDocument>
    <ram:TypeCode>130</ram:TypeCode>
  </ram:AdditionalReferencedDocument>
</ram:SpecifiedLineTradeSettlement>
✓ Correct
<ram:SpecifiedLineTradeSettlement>
  <ram:AdditionalReferencedDocument>
    <ram:TypeCode>130</ram:TypeCode>
  </ram:AdditionalReferencedDocument>
</ram:SpecifiedLineTradeSettlement>
Technical details

The rule counts ram:AdditionalReferencedDocument elements in the rule context whose normalized ram:TypeCode equals 130. The count must be no greater than one.

Where the rule applies

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

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ ram:SpecifiedLineTradeSettlement
Test expression (assert/@test)
count(ram:AdditionalReferencedDocument[normalize-space(ram:TypeCode) = '130']) <= 1