RoleCode at most once

Error FX-SCH-A-001154 Factur-X

Element 'ram:RoleCode' 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

The same ram:ManufacturerTradeParty contains ram:RoleCode more than once.

What the rule means

At most one ram:RoleCode is allowed within this element for the manufacturer. Multiple occurrences repeat this role field.

Please include `ram:RoleCode` for the manufacturer no more than once

The product manufacturer has multiple ram:RoleCode elements. Remove the extra occurrence so the element appears only once.

What to do
  1. Locate ram:ManufacturerTradeParty for the product on the invoice line.
  2. Check its ram:RoleCode elements and leave no more than one.
  3. Generate the invoice again and validate it again.
What it looks like
✗ Triggers the message
<ram:ManufacturerTradeParty>
  <ram:RoleCode>A</ram:RoleCode>
  <ram:RoleCode>B</ram:RoleCode>
</ram:ManufacturerTradeParty>
✓ Correct
<ram:ManufacturerTradeParty>
  <ram:RoleCode>A</ram:RoleCode>
</ram:ManufacturerTradeParty>
Technical details

The test counts the direct ram:RoleCode elements within ram:ManufacturerTradeParty and allows no more than one.

Where the rule applies

This rule applies within ram:ManufacturerTradeParty for a product on an invoice line.

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