ArticleslgStudy

science

Schematron

Schematron is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Schematron rather than just read about it. In short: Schematron is a rule-based validation language for making assertions about the presence or absence of patterns in XML trees. It is a structural schema language expressed in XML using a small number of elements and XPath languages.

Key takeaways

  • Schematron belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Schematron to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Schematron from memory before moving on to harder problems.

Reference excerpt

Schematron is a rule-based validation language for making assertions about the presence or absence of patterns in XML trees. It is a structural schema language expressed in XML using a small number of elements and XPath languages. In many implementations, Schematron XML is processed into XSLT code for deployment anywhere that XSLT can be used. Schematron is capable of expressing constraints in ways that other XML schema languages like XML Schema and DTD cannot. For example, it can require that the content of an element be controlled by one of its siblings. Or it can request or require that the root element, regardless of what element that is, must have specific attributes. Schematron can also specify required relationships between multiple XML files. Constraints and content rules may be associated with "plain-English" (or any language) validation error messages, allowing translation of numeric Schematron error codes into meaningful user error messages. Users of Schematron define all the error messages themselves. The current ISO recommendation is Information technology, Document Schema Definition Languages (DSDL), Part 3: Rule-based validation, Schematron (ISO/IEC 19757-3:2025).

Uses Constraints are specified in Schematron using an XPath-based language that can be deployed as XSLT code, making it practical for applications such as the following:

Adjunct to Structural Validation By testing for co-occurrence constraints, non-regular constraints, and inter-document constraints, Schematron can extend the validations that can be expressed in languages such as DTDs, RELAX NG or XML Schema. Lightweight Business Rules Engine Schematron is not a comprehensive, Rete rules engine, but it can be used to express rules about complex structures with an XML document. XML Editor Syntax Highlighting Rules Some XML editors use Schematron rules to conditionally highlight XML files for errors. Not all XML editors support Schematron.

Versions Schematron was invented by Rick Jelliffe while at Academia Sinica Computing Centre, Taiwan. He described Schematron as "a feather duster to reach the parts other schema languages cannot reach". The most common versions of Schematron are:

Schematron 1.0 (1999) Schematron 1.3 (2000): This version used the namespace http://xml.ascc.net/schematron/. It was supported by an XSLT implementation with a plug-in architecture. Schematron 1.5 (2001): This version was widely implemented and can still be found. Schematron 1.6 (2002): This version was the base of ISO Schematron and obsoleted by it. ISO Schematron (2006): This version regularizes several features, and provides an XML output format, Schematron Validation Report Language (SVRL). It uses the new namespace http://purl.oclc.org/dsdl/schematron. ISO Schematron (2010) ISO Schematron (2016): This version added support for XSLT2. ISO Schematron (2020): This version added support for XSLT3.

Schematron as an ISO Standard Schematron has been standardized by the ISO as Information technology, Document Schema Definition Languages (DSDL), Part 3: Rule-based validation, Schematron (ISO/IEC 19757-3:2025). This standard is currently not listed on the ISO Publicly Available Specifications list. Paper versions may be purchased from ISO or national standards bodies. Schemas that use ISO/IEC FDIS 19757-3 should use the following namespace:

Sample rule Schematron rules can be created using a standard XML editor or XForms application. The following is a sample schema:

This rule checks to make sure that the ContractDate XML element has a date that is before the current date. If this rule fails the validation will fail and an error message which is the body of the assert element will be returned to the user.

Implementation Schematron schemas are suitable for use in XML Pipelines, thereby allowing workflow process designers to build and maintain rules using XML manipulation tools. The W3C's XProc pipelining language, for example, has native support for Schematron schema processing through its "validate-with-schematron" step. Since Schematron schemas can be transformed into XSLT stylesheets, these can themselves be used in XML Pipelines which support XSLT transformation. An Apache Ant task can be used to convert Schematron rules into XSLT files. There exists also native Schematron implementation, like the Java implementation from Innovimax/INRIA, QuiXSchematron, that also do streaming.

See also XML Schema Language comparison - Comparison to other XML Schema languages. Service Modeling Language - Service Modeling Language uses Schematron. Document Schema Definition Languages

References

External links Academia Sinica Computing Centre's Schematron Home Page A book on Schematron (in German) Schematron online tutorial and reference

Worked examples

Example 1 — a first encounter with Schematron

Start with the simplest possible case. Write down what Schematron claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Schematron before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Schematron ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Schematron

In research
Schematron appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Schematron in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Schematron is common in secondary-school and first-year university syllabi. It links to neighbouring topics Data modeling languages, ISO/IEC standards, XML, so understanding it makes those chapters shorter.
In everyday life
Look for Schematron outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Schematron in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Schematron means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Schematron out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Schematron in simple terms?

Schematron is a rule-based validation language for making assertions about the presence or absence of patterns in XML trees. It is a structural schema language expressed in XML using a small number of elements and XPath languages.

Why does Schematron matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Schematron?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Schematron.

Tags

  • Data modeling languages
  • ISO/IEC standards
  • XML
  • XML-based programming languages
  • XML-based standards

Keep exploring