Include ram:SpecifiedTaxRegistration no more than once

Error FX-SCH-A-000712 Factur-X

Element 'ram:SpecifiedTaxRegistration' 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 ram:ProductEndUserTradeParty contains more than one ram:SpecifiedTaxRegistration element.

What the rule means

ram:SpecifiedTaxRegistration is optional in this party element but may occur only once. Multiple tax registration elements at this location do not conform to the required structure.

Please include the product end user’s tax registration no more than once

ram:SpecifiedTaxRegistration appears multiple times in ram:ProductEndUserTradeParty. This element may appear there at most once.

What to do
  1. Find the relevant ram:ProductEndUserTradeParty.
  2. Remove any extra ram:SpecifiedTaxRegistration elements there, or omit the element if no tax registration is to be provided.
  3. Generate the invoice again and validate it once more.
What it looks like
✗ Triggers the message
<ram:ProductEndUserTradeParty>
  <ram:SpecifiedTaxRegistration/>
  <ram:SpecifiedTaxRegistration/>
</ram:ProductEndUserTradeParty>
✓ Correct
<ram:ProductEndUserTradeParty>
  <ram:SpecifiedTaxRegistration/>
</ram:ProductEndUserTradeParty>
Technical details

The test counts the direct ram:SpecifiedTaxRegistration elements in the current ram:ProductEndUserTradeParty and allows no more than one.

Where the rule applies

The rule applies to ram:SpecifiedTaxRegistration within ram:ProductEndUserTradeParty in the invoice agreement.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ ram:ProductEndUserTradeParty
Test expression (assert/@test)
count(ram:SpecifiedTaxRegistration)<=1