At most one role code

Error FX-SCH-A-000795 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

ram:RoleCode appears more than once in ram:ShipFromTradeParty. The test allows this element at most once.

What the rule means

The limit prevents multiple role codes from being provided for the same consignor.

Please use no more than one `ram:RoleCode` in `ram:ShipFromTradeParty`

ram:RoleCode has been provided more than once for the consignor. This element may appear no more than once in this section.

What to do
  1. Find ram:ShipFromTradeParty in the delivery details.
  2. Check the ram:RoleCode elements it contains and remove any extra occurrences.
  3. Generate the invoice again and validate it once more.
What it looks like
✗ Triggers the message
<ram:ShipFromTradeParty>
  <ram:RoleCode>A</ram:RoleCode>
  <ram:RoleCode>B</ram:RoleCode>
</ram:ShipFromTradeParty>
✓ Correct
<ram:ShipFromTradeParty>
  <ram:RoleCode>A</ram:RoleCode>
</ram:ShipFromTradeParty>
Technical details

The XPath test counts the direct ram:RoleCode elements within ram:ShipFromTradeParty and requires the count to be no greater than one.

Where the rule applies

The rule applies to ram:RoleCode within ram:ShipFromTradeParty.

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