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
| XML Source | PDF (for print) | Author Link | Typeset PDF |
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 & rather than a good old Anglo-Saxon ∧? 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 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:
<element-map>
<from>my-element-name</from>
<to>schema-element-name</to>
</element-map>
<attribute-map>
<from>my-attribute-name</from>
<to>schema-attribute-name</to>
</attribute-map>
<attribute-values-map>
<from>my-value1</from><to>schema-value1</to>
<from>my-value2</from><to>schema-value2</to>
</attribute-values-map>
<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>
<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:
<default-attribute-values>
<name>attribute-name</name>
<default-value force-default="true">
attribute-value
</default-value>
</default-attribute-values
<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.