Concept Definition
What is Schematron?
Schematron is an ISO/IEC 19757-3 rule-based XML validation language. Unlike XSD, Schematron defines business rules as assertions against XPath expressions. In e-invoicing, Schematron validates cross-field rules and conditional requirements that XSD cannot express, such as requiring a payment account when a specific payment method is declared.
How is Schematron used in Peppol validation?
Peppol publishes Schematron rule sets as part of its BIS specifications. Validators apply these rules after XSD validation. Rules include fatal errors (invoice must be rejected) and warnings (invoice should be corrected but may be processed).
- Fatal rules: Violations cause invoice rejection. Example: missing mandatory buyer VAT number.
- Warning rules: Violations trigger a warning but do not reject the invoice. Example: recommended field missing.
- Rule IDs: Each Schematron rule has a unique ID (e.g., PEPPOL-EN16931-R001) for traceability.
Frequently Asked Questions
- Is Schematron part of the UBL standard?
- No. Schematron is a separate ISO standard. It is used alongside UBL (and CII) to validate business rules. OASIS publishes UBL Schematron files alongside the UBL XSD schemas.
- Can Schematron validation be performed in a browser?
- Yes. Schematron can be transformed to XSLT and executed in environments that support XSLT processing, including server-side Java or .NET processors and some browser-side JavaScript XSLT implementations.