Home arrow XML arrow More Schematron Features

More Schematron Features

In my last two articles, I covered the basics of Schematron—enough of it to create a basic schema with assertions, rules and patterns. However, there is more to Schematron than was covered in those articles, and some of Schematron's other features are very useful and worth mentioning. In this article, we'll take a look at more of Schematron's features, delving deeper into the Schematron schema language.

Author Info:
By: Peyton McCullough
Rating: 5 stars5 stars5 stars5 stars5 stars / 3
January 22, 2009
  1. · More Schematron Features
  2. · More on assertions
  3. · Declaring variables with the let element
  4. · Phases
  5. · Diagnostics

print this article

More Schematron Features
(Page 1 of 5 )


As a modern schema language, Schematron, of course, provides support for namespaces. Consider a document like this:

<ds:articles xmlns:ds="http://developershed.com">
        <ds:name>Using Schematron</ds:name>
        <ds:name>More Schematron</ds:name>

In order for patterns to match properly, and for Schematron to operate, namespaces need to be declared in the schema. This is very simple to do, and is done using the ns element. The ns element must be declared as a child of the schema element. It has two attributes: prefix and uri. These correspond, of course, to the namespace prefix and the namespace URI. In order to declare the namespace used above, the following XML would be used:

<ns prefix="ds" uri="http://developershed.com"/>

Now the schema will work properly with the document:

<assert test="ds:name">An article must have a name.</assert>

blog comments powered by Disqus

- Open XML Finally Supported by MS Office
- XML Features Added to Two Systems
- Using Regions with XSL Formatting Objects
- Using XSL Formatting Objects
- More Schematron Features
- Schematron Patterns and Validation
- Using Schematron
- Datatypes and More in RELAX NG
- Providing Options in RELAX NG
- An Introduction to RELAX NG
- Path, Predicates, and XQuery
- Using Predicates with XQuery
- Navigating Input Documents Using Paths
- XML Basics
- Introduction to XPath

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials