RE: [xsl] XSLT workflow: ODF <-> XPP

Subject: RE: [xsl] XSLT workflow: ODF <-> XPP
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 28 May 2009 09:55:59 +0100
> The problem is, that the two formats are not interchangeable, 
> and this breaks the whole workflow. They have a filter to 
> import ODF to XPP (the easy part). They also have another to 
> convert back from XPP to ODF, but it discards XPP processing 
> instructions that were added while styling. That means a 
> roundtrip is not possible, because the existing inline XPP 
> styling would be lost.

This problem crops up all the time in different guises. It's the same as the
code-generation problem: you generate some code from say a visual query
builder, then you tweak the generated code, then you want to regenerate some
slightly different code without losing your tweaks.

There's no general solution to the problem but there seem to be a number of
techniques that can half-solve the problem.

(a) change the reverse transformation so that it doesn't discard the extra
information (the "processing instructions" or "tweaks"), but hides them
somewhere in the ODF where they will survive unscathed through the
operations performed at the ODF level - if necessary, as user-visible text
(though you can probably do better than that)

(b) do a reconciliation: when the XPP is regenerated, compare it with the
"tweaked" XPP from the previous version, and try to find where the tweaks
are and reapply them to the new XPP version. This is a bit like merging of
branches in CVS.

(c) change the way you "tweak" the XPP so that the changes are logged as you
make them and can be reapplied to a new version of the XPP.

That's a very high-level description of ideas which might not translate
directly into the reality of the situation, but if you don't want to lose
the "tweaking" work then you're going to have to find something along one of
these lines.

Since you are converting the XPP back to ODF already, I would look for a
solution along the lines of (a). A variant of this would be, instead of
hiding the tweaks in the ODF, generate a separate file containing all the
"tweaks", that can then be applied to the regenerated XPP, along the lines
of (c). 

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

Current Thread