Provide exactly one VAT information entry per sub invoice line

Error BR-DEX-03 XRechnung

A Sub Invoice Line (BG-DEX-01) shall contain exactly one "SUB INVOICE LINE VAT INFORMATION" (BG-DEX-06).

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

When a cac:SubInvoiceLine contains a cac:Item, that element does not have exactly one cac:ClassifiedTaxCategory element. VAT information is therefore either missing or present more than once.

What the rule means

Each cac:Item present on a sub invoice line must contain exactly one VAT category. This makes the related VAT information unambiguous.

Please provide exactly one VAT category for each sub invoice line

The item on a sub invoice line is missing its VAT category, or the category appears more than once. You can set the number of cac:ClassifiedTaxCategory elements to exactly one.

What to do
  1. Find the cac:Item of the affected cac:SubInvoiceLine.
  2. Check the number of associated cac:ClassifiedTaxCategory elements.
  3. Make sure exactly one such element is present.
  4. Regenerate the invoice and validate it again.
What it looks like
✗ Triggers the message
<cac:SubInvoiceLine>
  <cac:Item/>
</cac:SubInvoiceLine>
✓ Correct
<cac:SubInvoiceLine>
  <cac:Item>
    <cac:ClassifiedTaxCategory/>
  </cac:Item>
</cac:SubInvoiceLine>
Technical details

The test selects cac:Item elements under cac:SubInvoiceLine and fails when such an element does not have exactly one direct cac:ClassifiedTaxCategory child. A missing cac:Item is not detected by this test.

Where the rule applies

The rule applies to cac:Item within each cac:SubInvoiceLine in an extended UBL invoice.

Original message from the Schematron
Eine Sub Invoice Line (BG-DEX-01) muss genau eine "SUB INVOICE LINE VAT INFORMATION" (BG-DEX-06) enthalten.
Context (rule/@context)
/ubl:Invoice[$isExtension]
Test expression (assert/@test)
not(exists(//cac:SubInvoiceLine/cac:Item[ count ( cac:ClassifiedTaxCategory) != 1]))