Home arrow XML arrow More Schematron Features
XML

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 / 1
January 22, 2009
TABLE OF CONTENTS:
  1. · More Schematron Features
  2. · More on assertions
  3. · Declaring variables with the let element
  4. · Phases
  5. · Diagnostics

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
More Schematron Features
(Page 1 of 5 )

Namespaces

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:article>
        <ds:name>Using Schematron</ds:name>
    </ds:article>
    <ds:article>
        <ds:name>More Schematron</ds:name>
    </ds:article>
</ds:articles>


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
XML ARTICLES

- 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
- Simple Web Syndication with RSS 2.0
- Java UI Design with an IDE

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



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