What is Schematron and how does it enforce business rules on the DBNAlliance’s B2B Digital Highway?

Schematron is an XML-based rule language designed to validate the content and structure of XML documents, including e-invoices. Unlike traditional schema languages (such as XSD), which focus mainly on enforcing structural constraints and data types, Schematron is exceptionally good at expressing business rules and contextual validations.

Key takeaways

  • Schematron enforces real-world business rules within XML-based e-invoices, ensuring logical and contextual accuracy.
  • It enables interoperability by validating documents against agreed standards and code lists, ensuring all systems “speak the same language.”
  • The DBNAlliance’s Schematron framework ensures that invoices follow a uniform set of business rules, making electronic document exchange seamless and compliant.

How does Schematron work?

It works by applying XPath-based assertions and reports within defined contexts in an XML document. In simple terms, an ‘assertion’ is just a rule that checks whether the information in a document makes sense. In Schematron, these rules are expressed using a standard language called XPath, which can look inside an XML document and find the exact piece of data you want to check.

Think of it like this:

  • An assertion says, “this must be true”.
  • If it’s true, the document passes that check.
  • If it’s false, the system flags an error or warning. 

An example of a Schematron rule in plain language would be “If an invoice has a due date, it must not be earlier than the issue date.”

Assertions are powerful because they allow organisations (including the DBNAlliance) to embed real business rules — not just data format checks — directly into the validation of documents. That means mistakes like missing references, invalid country codes, or illogical dates can be automatically caught before they cause downstream problems impacting business trading partners and document processing in the ERP or accounting system.

Benefits of Schematron

Schematron allows organisations to capture complex requirements — for example, “If an invoice has a tax amount, it must also specify a tax category” — directly as machine-checkable rules. Schematron is widely used in domains like e-invoicing, healthcare, and government reporting, where compliance with highly specific rule sets is critical. In practice, it serves both as a technical validation tool and as a way of documenting rules in a human-readable, traceable form.

How Schematron helps create interoperability

Schematron supports interoperability by making sure that every document follows the same business logic and code lists, so that systems can automatically exchange, validate, and process them without misunderstandings.

Interoperability means that two or more systems — often from different organisations, countries, or industries — can reliably exchange and understand each other’s documents. Schematron plays a key role in this by ensuring that every XML document (such as an electronic invoice) not only follows the same structure but also obeys the same business rules.

Key benefits 

  • Consistent interpretation of data
    • Without Schematron, two invoices might look structurally correct but mean different things.
    • Schematron rules check the meaning of fields (e.g., ensuring currency codes are ISO 4217, tax codes come from an agreed list).
    • This removes ambiguity so all parties (including both trading partners and ERP systems) interpret the data the same way.
  • Validation against agreed standards
    • Business networks (like e-invoicing alliances or government mandates) publish a Schematron profile.
    • Every participant validates documents against that same set of rules.
    • This guarantees documents are “standardised” before they are exchanged.
  • Context-sensitive checks
    • Traditional XML schemas (XSD) only enforce structure (e.g., “a date must look like a date”).
    • Schematron enforces contextual rules (e.g., “the due date must not be before the issue date”, “VAT invoices must include a tax type”).
    • This ensures that business-critical relationships are consistent across systems.
  • Error visibility
    • When a rule fails, Schematron provides a clear human-readable message.
    • This allows senders and receivers to quickly identify and fix errors before exchange, reducing failed transactions.

Summary of DBNAlliance’s rules for the Core Invoice

UBL fieldTypeRuleXPath test
cbc:UBLVersionIDErrorUBL Version ID must equal 2.3(. = '2.3')
cbc:ProfileIDErrorProfile ID must equal bdx:noprocess(. = 'bdx:noprocess')
cbc:CustomizationIDErrorCustomization ID must equal urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##DBNAlliance-1.0-data-Core(. = '…DBNAlliance-1.0-data-Core')
cbc:DocumentCurrencyCodeErrorDocumentCurrencyCode must be valid ISO 4217 currency codecontains(…) allow-list of ISO 4217
cac:Country/cbc:IdentificationCodeErrorCountry Identification Code must be valid ISO 3166 alpha-2 codecontains(…) allow-list of ISO 3166
cbc:InvoicedQuantity/@unitCodeErrorInvoicedQuantity/@unitCode must be valid X12 Unit of Measure codecontains(…) allow-list of X12 UOM
cbc:PaymentMeansCodeErrorPaymentMeansCode must be valid X12 Payment Method Type codecontains(…) allow-list of X12 PMT
cbc:AllowanceChargeReasonCodeErrorAllowanceChargeReasonCode must be valid X12 Special Charges/Allowance Reason codecontains(…) allow-list of X12 reasons
cbc:TaxTypeCodeErrorTaxTypeCode must be valid X12 Tax Type codecontains(…) allow-list of X12 tax types

What does this mean in practice?

Use this simple non-technical compliance checklist to ensure your DBNAlliance Core Invoice is compliant and will pass Schematron validation and be accepted onto the B2B Digital Highway by your own and your trading partner’s certified DBNAlliance access point:

  • UBL Version ID → Must equal 2.3
  • Profile ID → Must equal bdx:noprocess
  • Customization ID → Must equal 
    urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##DBNAlliance-1.0-data-Core
  • Document Currency Code → Must be valid ISO 4217 currency code
  • Country Identification Code → Must be valid ISO 3166 alpha-2 country code
  • Invoiced Quantity Unit Code → Must be valid ANSI X12 Unit of Measure code
  • Payment Means Code → Must be valid X12 Payment Method Type code
  • Allowance Charge Reason Code → Must be valid X12 Special Charges/Allowance Reason code
  • Tax Type Code → Must be valid X12 Tax Type code

What are code lists?

A code list is a standardised set of predefined values that can be used in certain data fields of an e-invoice (or other business document). Instead of free text, the sender must use an agreed code from the list, so that the receiver’s system can interpret it correctly.

Think of it like a data dictionary of allowed values: it prevents misunderstandings by ensuring everyone uses the same language when describing categories such as currencies, countries, units of measure, tax types, tax exemption reasons, and payment methods.

Why code lists matter for interoperability

  • Clarity: Instead of writing “US Dollars”, “$”, or “Dollars”, everyone uses the exact code USD (ISO 4217). This removes the need for custom transformation rules or a reliance on look-up tables in e-invoicing software, ERPs and other business platforms.
  • Automation: Systems (and Schematron) can validate automatically that a code is correct (e.g., GBP is valid, UKP is not).
  • National and cross-border exchange: By sticking to global or industry code lists, invoices can be understood the same way across an entire country, internationally, and by diverse ERP and service provider ecosystems.
  • Compliance: Many government or industry frameworks mandate the use of specific code lists (ISO, X12, UN/ECE, etc.). This becomes more important under e-reporting, live reporting, or Continuous Transaction Controls (CTC) models. 

What code lists does the DBNAlliance leverage for an invoice?

The DBNAlliance’s framework leverages a number of different code lists.

  • ISO 4217 alphabetic currency code
  • ISO 3166-1 alpha-2 country code
  • X12 Unit or Basis for Measurement Code
  • X12 Payment Method Code
  • X12 Tax Type Code 
  • X12 SAC02 Service/Promotion/Allowance/Charge Code

The DBNAlliance is a certified network that enables secure, structured electronic invoice exchange. It connects businesses across the U.S. through standardised formats, such as those supported by the Peppol network outside the U.S. 

Now any U.S. business can send and receive e-invoices to millions of other U.S. businesses for free* through the Avalara DBNAlliance Access Point and your certified ERP connector. *Subject to terms and conditions

To learn more and discuss, contact Avalara.

FAQ

What is Schematron used for in e-invoicing? 
Schematron is used to validate XML-based business documents like e-invoices, ensuring they meet both structural and contextual business rules before exchange.

How does the DBNAlliance use Schematron? 
The DBNAlliance uses Schematron validation to enforce standardised rules and code lists, guaranteeing that all participants’ invoices follow the same logic and comply with interoperability requirements.

Why are code lists important for interoperability? 
Code lists standardise values such as currency, tax types, and country codes, ensuring all systems interpret invoice data consistently — a key requirement for cross-platform automation and compliance.

Recent posts
The end of the €150 customs duty exemption for low-value imports into the EU: What businesses need to know
Shipping to the US? Avoid costly surprises. Here’s how.
U.S. sales tax exemptions 101
Avalara Tax Changes 2025

The Avalara Tax Changes midyear update is here

Trusted by professionals, this valuable resource simplifies complex topics with clarity and insight.

Get the latest update

Stay up to date

Sign up for our free newsletter and stay up to date with the latest tax news.