Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

Chapter 2. Schematron, XSLT, and XPath - Pg. 2

Introduction Schematron is a simple tool that anyone working with XML should have in his toolbox. Its basic structures are basic, and its flexibility is immense. If you are a W3C XML Schema user, you will find Schematron most useful in working around W3C XML Schema limitations, including issues such as checking for a specific root element, forbidding xsi:type attributes, dealing with co- occurrence constraints and handling unordered content models. If you are a RELAX NG user, you will find Schematron especially suitable for implementing keys and key references in a very flexible way. In both cases, Schematron will also help you keep your schemas simpler and define "business rules," such as checking that a start date is earlier than an end date. If you are familiar with XPath but don't know any schema language, you'll be happy to learn that Schematron is based on XPath, and you will find Schematron much easier to learn than any other schema language. In any case, you will appreciate Schematron's unique ability to let you define your own user-friendly error messages rather than having to rely on obscure error messages generated by a schema processor.