RelaxNG specifications contain recomendations in order to simplify a schema : The steps to follow are more detailed there.

That page simply presents the way I use RelaxNG simplification implemented by Eric van der Vlist which can be found there.

I corrected some bugs I found and I split the simplification.xsl into several XSLT. That way, I am able to simplify my RelaxNG schemas from javascript with browser's embedded XSLT processors.

Splitting the simplification.xsl, I could remove the code which triggers next step of simplification from the previous step. It also does not log any more the results of the differents steps of simplification.

Simplifying RelaxNG

Follow the steps :

  1. Copy/Paste some RelaxNG specification in the textarea or import one from the samples.
  2. Select the steps you want to apply.
  3. Click on "Simplify ->".


Simplifying the RelaxNG schemas is a first step in order to be able to validate a XML document against it.

The steps of simplification defined in the RelaxNG specification explain how to transform a full syntax written schema into a simple syntax one.


Bugs corrected

In step 10 : prefix "rng:" was missing in lines <xsl:with-param name="node-name" select="'rng:group'"/> resulting with markups <group> with default namespace (which is not RelaxNG) in output.

In step 14 : add concatenation of prefix "rng:" before value of "combine" attributes in lines <xsl:param name="node-name" select="concat('rng:',parent::*/rng:start/@combine)"/>.

In step 14 : In template <xsl:template match="rng:start[not(preceding-sibling::rng:start) and following-sibling::rng:start]"> I removed the element addition <xsl:element name="{parent::*/rng:start/@combine}"> because it results to an extra <rng:choice> surrounding the other <rng:choice> inside the <rng:start>.

In step 15 : seems that template <xsl:template match="/*"> has a higher priority than template <xsl:template match="/rng:grammar">, so I had to add a precision : <xsl:template match="/*[not(self::rng:grammar)]">.


All those developments are released under Cecill licence.

The project Forms Generator is available on a svn, contact me for more information. In the future, a project might be created on sourceforge.

Projects svg 3d, XSD to RelaxNG converter, javascript SAX parser, javascript RelaxNG validator, javascript datatype library are published on Google code. Project javascript SAX parser is also published on Github.


In order to have javascript working as expected, please use last version of firefox.

For the applets, you will need to have java installed on your computer.