Re: [xsl] a simple RTF <> XML question
Subject: Re: [xsl] a simple RTF <> XML question|
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 18 Oct 2006 09:45:21 +0200
slacker hacker wrote:
question 2 is:
Given the simple nature of the transform needed, what tools (unix)
should I be looking at?
Just some thoughts:
I don't believe it is "simple" or "trivial" at all. Take any RTF, to
XML, back to RTF. Do you expect the output to be the same, apart from
some texts/names/data? It might be better using a simple regex tool like
sed or perl to do the transformation. But perhaps it is indeed easy, I
don't know, to get XML from RTF.
The reverse, I believe, is much simpler. You are on the right track
where you consider XSLFO. But there's a lot to learn. First XSLT (do you
go with 2.0 or 1.0? I recommend 2.0) language. Then XSLFO. Then RTF
again. Apache FOP is not yet up to grips with RTF, but it is oncoming.
Other parsers, I don't know.
More likely would be, considering the whole scenario, to get XSLFO from
RTF (xslfo is xml anyway, so this won't violate your first requirement,
and it gives you a generalized way to keep the font etc data). Do your
thing with it (but leave it intact as XSLFO, if possible). Now all you
need is parse the resulting XSLFO into RTF back again. But be not
surprised if the text layout will be off by a bit. Not sure there exists
a readymade tool to get xslfo from rtf, though.
-- Abel Braaksma