If we go back to the XSLT stylesheet we defined earlier: and then instantiate the template relative to the short Story element.The contents of a rule element operate within the context of the elements matched by its context attribute.They define the roles and structure of XML elements.DTDs are written in a syntax other than XMLs' and rely upon post-processing for validation. However, DTDs are a step behind the direction XML technologies are evolving: they don't support namespaces, and they use a non-XML syntax.
In this article I show how to do the latter and assume the reader is at least familiar with XML 1.0, DTDs, XSLT, and XPath.
With just a subset of XPath, powerful XSLT stylesheets can be created to process very complex XML instances.
Before digging into Schematron, I'll demonstrate how XSLT can easily be used to validate XML instances. You can imagine other combinations of templates that validate more complex XML structures. It takes a Schematron schema definition (in XML) that describes the constraints.
Rules Rule elements define a collection of constraints on a particular context in a document instance (for example, on an element or collection of elements).
This is very similar to XSLT templates, which are fired with respect to a node or group of nodes returned by an XPath expression.