At most one tax amount in the tax currency per invoice line

Error FX-SCH-A-000388 Factur-X

Element variant 'ram:TaxTotalAmount[@currencyID=/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:TaxCurrencyCode]' 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

In the invoice line summation, ram:TaxTotalAmount with an @currencyID value matching ram:TaxCurrencyCode occurs more than once. This variant may occur at most once.

What the rule means

The tax amount for an invoice line in the tax currency is stated at most once.

Please state the tax amount in the tax currency only once per invoice line

The tax amount in the tax currency was provided more than once for an invoice line. The invoice contains ram:TaxTotalAmount with the matching @currencyID more than once.

What to do
  1. Compare the @currencyID values of the ram:TaxTotalAmount elements with ram:TaxCurrencyCode.
  2. Make sure no more than one ram:TaxTotalAmount uses the tax currency.
  3. Generate the invoice again and validate it.
What it looks like
✗ Triggers the message
<ram:SpecifiedTradeSettlementLineMonetarySummation>
  <ram:TaxTotalAmount currencyID="EUR">1.00</ram:TaxTotalAmount>
  <ram:TaxTotalAmount currencyID="EUR">2.00</ram:TaxTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
✓ Correct
<ram:SpecifiedTradeSettlementLineMonetarySummation>
  <ram:TaxTotalAmount currencyID="EUR">1.00</ram:TaxTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
Technical details

The XPath counts only ram:TaxTotalAmount elements whose @currencyID matches the header ram:TaxCurrencyCode and limits their number to one.

Where the rule applies

The rule applies to ram:TaxTotalAmount in an invoice line summation when its @currencyID value matches ram:TaxCurrencyCode.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ ram:SpecifiedLineTradeSettlement/ram:SpecifiedTradeSettlementLineMonetarySummation
Test expression (assert/@test)
count(ram:TaxTotalAmount[@currencyID=/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ ram:ApplicableHeaderTradeSettlement/ram:TaxCurrencyCode])<=1