I remember talking with Michael last year about how I thought reversible XSLT was an important but unsolved problem. I was particularly interested in the scenario where you have a complex XML document, you transform it to a simpler or more readable form (XML, HTML, CSV, or whatever), edit it, and then you want to have it automatically transformed back to update the original XML document in a “similar” way.
Given my interest in configuration management, I had thought of attacking the problem from the perspective of “merging” the changes back to the source document. (I should at this point mention a great summary article about software merging by Tom Mens.) I doodled around a bit, but never really got my teeth into the problem.
Anyway, today I searched again, and found two great related projects, neither of which I’d found in my earlier searches.
The first project is XSugar. You define grammars in parallel for both the source and target forms, and xsugar unifies these to give you bi-directional parsing and pretty-printing (and also throws in static XML validity checks for free too!). Neat – and it definitely covers “reversible XSLT”. But it doesn’t cover the scenario I was thinking about, because the source and target sentences need to contain the same information. I wanted to be able to throw stuff away in the initial transformation and have it automagically recovered on the way back.
The second project seems to pretty much solve my original scenario, which is apaprently called the “View Update Problem”. (Now I know that name I’m sure I could find a whole world of relevant literature.) It’s the Harmony Project. I’ve only just started reading the details, and I’ll have to follow it up more later on, When I Have Time.