Missing or repeated delivery type code

Error FX-SCH-A-000319 Factur-X

Element 'ram:DeliveryTypeCode' must occur exactly 1 times.

Mandatory rule: As long as it is violated, the invoice is invalid and will be rejected by validators.
What is wrong

ram:ApplicableTradeDeliveryTerms does not contain exactly one ram:DeliveryTypeCode. The element is either missing or occurs more than once.

What the rule means

The delivery type code specifies the agreed delivery type. Exactly one value is required to make this information unambiguous.

Please provide the delivery type code exactly once

The delivery terms are missing the delivery type code, or it appears more than once. Providing it exactly once makes the delivery type clear.

What to do
  1. Find ram:ApplicableTradeDeliveryTerms.
  2. Make sure it contains exactly one ram:DeliveryTypeCode.
  3. Generate the invoice again and validate it again.
Technical details

The XPath test requires ram:DeliveryTypeCode to occur exactly once under ram:ApplicableTradeDeliveryTerms.

Where the rule applies

The rule applies within ram:ApplicableTradeDeliveryTerms in the seller-buyer agreement.

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