Three ways of writing XML transformation programs

by Rick Jelliffe

I made three prototype implementations of the Topologi XSD to RELAX NG Compact Syntax translator, before adopting a particular one.

First, I used Topologi's high-level inhouse Java library for XSD, which we use on other products. I looked at converting that into the Java API of one of the versions of RELAX NG in James Clarks' Trang translation software.

Second, I tried using XSLT to generate RELAX NG Compact Syntax directly.

Third, I looked at using XSLT 2 (Saxon) to generate RELAX NG as XML, then use Trang to convert from this XML to RELAX NG Compact Syntax.

Which one did I go with?


Bruce D'Arcus
2006-10-10 15:04:12
Question: why not convert the xs:documentation elements to RNG-namespaced documentation? Rather trivial detail admittedly.
Rick Jelliffe
2006-10-12 01:32:54
Most comments are translated to >> comments.
A few are removed in situations where RELAX NG compact does not allow them (the details escape me, it is something like comments on enumerated values).
And there is one or two situations where the comments are duplicated, both as [xs:documentation] and >> comments. Comments were not high on my priorities for making the Ecma draft deadline; however they certainly are high on the list of things to have right by the time the ISO standard comes out.
Aristotle Pagaltzis
2006-10-21 08:14:08
For the first stage in approach #3, couldn't XSLT 1.0, possibly using EXSLT, have done just as well? Or was 2.0 more of an incidental choice?

As for the outcome: #3 is effectively a two-stage transform (even if stage 2 wasn't XSLT), so the conclusion is not at all surprising. (In absence of Trang, the second stage would have been XSLT as well, and I expect that wouldn't have led to a particularly different result, it would just have taken more effort.) It's always nice to have hard data points from somewhat apples-to-apples comparisons, of course.