DSRL - Bringing Revolution to XML Workers

Martin Bryan
martin.bryan@csw.co.uk

Abstract

It's time Extremists revolted against what a plethora of standards bodies are trying to impose on what was originally promoted as a way for users to control how their documents should be processed. Today everybody from W3C to the UN are telling us what names we should use to markup our information. Why should we have to use their overly complex schemas, their stupidly long element names, their cryptic entity names or their simply stupid schema declaration language structures? Extremists need to take back control of what they call things in their own information space. Now the ultimate standards body, the International Organisation for Standards, has come to the rescue of Extremists such as yourself and developed DSRL, a simple language that will allow you to take control of your markup language while still being able to pay lip service to customers who insist on believing what standards bodies tell them.

Keywords: Markup Languages; Interoperability

Martin Bryan

I learnt the term "markup" at school more than 40 years ago, working in hot-metal in the school printing club printing dairies (no that's not a typo now, though it was then!) and other miscellania. Since then I've followed the evolution of markup languages from the ISO standardization of proofreaders marks to the latest examples of specialized XML-based markup languages.

Whilst not the longest serving member of the documentation preparation standards committees, I am one of the old timers, having put in my 20 years of service for ISO and related standards boards. I currently chair the ISO working group creating a new generation of Document Schema Definition Languages, which includes RELAX NG, Schematron and my own "baby", the Document Schema Renaming Language (DSRL).

DSRL - Bringing Revolution to XML Workers

Martin Bryan [CSW Informatics]

Extreme Markup Languages 2006® (Montréal, Québec)

Copyright © 2006 Martin Bryan. Reproduced with permission.

ISO/IEC 19757 defines a suite of Document Schema Description Languages (DSDL) that can be used to validate the structure and contents of XML documents. You already know and love two of the parts: Part 2 - RELAX NG and Part 3 - Schematron. I want to introduce you to the latest member of the suite, Part 8 - Document Schema Renaming Language (DSRL, pronounced "disrule").

Why would an Extremist want a Document Schema Renaming Language? In a word: antiestablishmentarianism. Eh!

What on earth has XML got to do with antiestablishmentarianism? Surely XML is above politics? Surely antiestablishmentarianism is a subject that is out of scope on even the most extreme conference circuits these days?

As an Extremist you are certainly in need of more antiestablishmentarianism. You are being imposed on by the establishment everywhere you turn. Now is the time to revolt!"

How many times have you been told "You should use schema XYZ" or "your tags don't conform to ABC" or "its no good writing schemas using PQR as most tools don't process them corrrectly"? How many times have your customers asked "What does Y stand for?" or "Why do you call this <ol> rather than <list>, or <numbered-list>?" Or have you, heretically, wondered why you have to enter a Latin contraction such as &amp; rather than a good old Anglo-Saxon &and;? If any of these questions have arisen in your working environment then you urgently need to become an antiestabilshmentarianist and promote the widespread adoption of DiSRuLe, the cure for most of XML's ailments.

DiSRuLe in 5 minutes

DiSRuLe is simple. It can be learnt in 5 minutes flat. After 15 minutes you will be a DiSRuLe expert. Here are the simple steps you need to follow:

  1. For each element whose name you want to map to that in another schema create a rule of the form:
               <element-map>
                   <from>my-element-name</from>
                   <to>schema-element-name</to>
               </element-map>
    
  2. For each attribute whose name you want to map to that in another schema create a rule, within the appropriate element map, of the form:
     
                 <attribute-map>
                     <from>my-attribute-name</from>
                     <to>schema-attribute-name</to>
                 </attribute-map>
  3. For each attribute value token whose name you want to map to that in another schema create a rule, within the appropirate attribute map, of the form:
     
                  <attribute-values-map>
                      <from>my-value1</from><to>schema-value1</to>
                      <from>my-value2</from><to>schema-value2</to>
                  </attribute-values-map>
  4. For each of entity whose name you want to map to that in another schema create a rule of the form:
     
                 <entity-name-map>
                     <from>my-name1</from><to>xml-name</to>
                     <from>my-name2</from><to>html-name</to>
                     <from>my-name3</from><to>dtd-name</to>
                 </entity-name-map>
  5. For each of processing instruction type whose name you want to map to that in another schema create a rule of the form:
     
                  <map-pi-target>
                      <from>my-PI-name1</from>
                      <from>my-PI-name2</from>
                      <to>schema-PI-name</to>
                  </map-pi-target>

In addition you can manage the values of attributes and the content of elements:

  1. For each attribute that you want to give a default value to create a rule, within the attribute map, of the form:
     
                <default-attribute-values>
                      <name>attribute-name</name>
                      <default-value force-default="true">
                         attribute-value
                      </default-value>
                </default-attribute-values
  2. For each element that you want to give a default value to create a rule of the form:
                <default-content force-default="true">
                    Default content
                </default-content> 

The only other thing you need to know is how to identify which schema you are mapping to, which is done in the wrapper element:

             
               <maps xmlns="http://purl.oclc.org/dsdl/dsrl"
                     targetNamespace="http://csw.co.uk/addresses"
                     targetSchemaLocation="EuropeanAddress.xsd"> 

DiSRuLe can also be used to transliterate schemas. By associating a map with a schema, and invoking a ConvertXMLSchema.xsl transformation instead of the default TransformDSRLMaps.xsl transformation, you can create a schema that will allow you to validate documents created using your own namespaces. For those of you that prefer to work with RELAX NG schemas, there is a ConvertRelaxNG.xsl options, but we have yet to provide the more complex ConvertDTD and ConvertRelaxNG options as XSLT 2.0 stylesheets. These must wait for someone to implement DiSRuLe in software, unless there is some really keen exponent of the XSLT 2.0 xsl:analyze-string option who would like to take up the challenges presented by these two options.

That's it folks. You're now an expert in the use of DiSRuLe. Simply download the XSLT2.0 transforms we provide on DSDL.ORG and you can start creating stylesheets that will transform your markup into a form that can be validated against the schema of their schema.


DSRL - Bringing Revolution to XML Workers

Martin Bryan [CSW Informatics]
martin.bryan@csw.co.uk