At most one subject code per note

Error FX-SCH-A-000161 Factur-X

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

An ram:IncludedNote contains more than one ram:SubjectCode. The element may occur at most once within a note.

What the rule means

The subject code assigns a category to a note. Multiple subject codes for the same note are not permitted by this rule.

Please use no more than one subject code per note

A note contains more than one ram:SubjectCode. You can adjust the XML so that the note contains no more than one subject code.

What to do
  1. Locate the affected ram:IncludedNote.
  2. Check its ram:SubjectCode elements and remove any occurrences beyond the first.
  3. Generate the invoice again and validate it once more.
What it looks like
✗ Triggers the message
<ram:IncludedNote>
  <ram:SubjectCode>...</ram:SubjectCode>
  <ram:SubjectCode>...</ram:SubjectCode>
</ram:IncludedNote>
✓ Correct
<ram:IncludedNote>
  <ram:SubjectCode>...</ram:SubjectCode>
</ram:IncludedNote>
Technical details

The XPath test counts the ram:SubjectCode elements in the current ram:IncludedNote and passes when the count is at most one.

Where the rule applies

The rule applies to ram:IncludedNote notes in the document header.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:ExchangedDocument/ram:IncludedNote
Test expression (assert/@test)
count(ram:SubjectCode)<=1