The Schematroll: our mascot (courtesy Kody Chang)

The Schematron

An XML Structure Validation Language using
Patterns in Trees

The Schematron is a simple and powerful Structural Schema Language.
It is now an ISO standard
ISO/IEC 19757 - DSDL Document Schema Definition Language -
Part 3: Rule-based validation - Schematron

Schematron is regularly reinvented, independently: this shows both that it meets a widespread need and that the approach it takes (assertions and Xpaths) is convenient to implement and to think about. ISO Schematron is the result of enhancing Schematron, the leading assertion language, with improvements gleaned from other, subsequent similar languages and from multiple developers on all the most important modern platforms, and from almost five years of use. Schematron is mature, well-respected, widely implemented, well thought out, and, most importantly, small enough to be convenient. In 2007, please consider adopt ISO Schematron, rather than rolling your own home-made or proprietary language. Members of standards committees evaluating Schematron-like alternatives may appreciate that ISO Schematron is a framework that allows use of other domain-specific languages in place of the default XPaths. Rick Jelliffe

(If you have have news about Schematron or similar schema languages, please email Rick Jelliffe ricko (at)

News 2006


News 2005


News 2004

News 2003


News 2002

Before May

(Due shifts in countries and jobs, I was not able to maintain this list for about a year. I apologise for this, especially for people who had news - Rick Jelliffe)

News 2001


For old news, see the old home page.


The Schematron differs in basic concept from other schema languages in that it not based on grammars but on finding tree patterns in the parsed document. This approach allows many kinds of structures to be represented which are inconvenient and difficult in grammar-based schema languages. If you know XPath or the XSLT expression language, you can start to use The Schematron immediately.

And it has free and open source implementations available. The Schematron is trivially simple to implement on top of XSLT and to customize. (There are also implementations in Python and Perl)

The Schematron allows you to develop and mix two kinds of schemas:

The Schematron is based on a simple action:

The Schematron can be useful in conjunction with many grammar-based structure-validation languages: DTDs, XML Schemas, RELAX, TREX, etc. You can even embed a Schematron schema inside an XML Schema <appinfo> element!

Schematron's Six Basic Elements

There are only 6 basic elements in Schematron 1.5 which makes it very easy to learn, especially if you already know XPaths. (There are others, but these mainly just help construct nice user interfaces for validators.) Here is the basic structure

So here is a very small example. It is a mini-schema for Schematron.

<schema xmlns="">
  <title>A Schematron Mini-Schema for Schematron</title>
  <ns prefix="sch" uri="">
    <rule context="sch:schema">
      <assert test="sch:pattern"
      >A schema contains patterns.</assert>
      <assert test="sch:pattern/sch:rule[@context]"
      >A pattern is composed of rules.
      These rules should have context attributes.</assert>
      <assert test="sch:pattern/sch:rule/sch:assert[@test] or sch:pattern/sch:rule/sch:report[@test]"
      >A rule is composed of assert and report statements. 
      These rules should have a test attribute.</assert> 

In that mini-schema, the rule element sets the context: the rule applies to any sch:schema element in a document. The rules say that there must be at least one child element sch:pattern, at least one child element sch:pattern with a child sch:rule with a context attribute, and at least one child element sch:pattern with a child sch:rule with a sch:assert or sch:reportwith a test attribute.

This is probably not the most useful schema: it only tells you what is wrong with an empty document rather than checking a full Schematron schema. However, it does show that there are many different kinds of schemas possible: some of them similar to DTDs and some of them very different. Schematron lets you perform many kinds of new validation!

Copyright 1999-2001 (C) Rick Jelliffe, Academia Sinica Computing Centre, Taibei. The Schematron software and this page are available for any public use, under the conditions of the zlib/libpng license (the least restrictive), but please mention our names in any documentation or About screens for any products that uses it. Comments, fixes and upgrades welcome: email

Academia Sinica Chinese XML Now! project The Schematroll: our mascot (courtesy Kody Chang)