RE: [xsl] a simple RTF <> XML question

Subject: RE: [xsl] a simple RTF <> XML question
From: "Nilsson, David F" <dfnilsson@xxxxxxxxxx>
Date: Wed, 18 Oct 2006 16:18:14 -0400
slacker hacker says he wants to:

> 1:  read RTF, convert to XML  (not a problem)
> 2:  pass XML to tool (not a problem)
> 3:  get XML result and write XML final version (not a problem)
> 4:  convert XML back to RTF  (omg is this complicated!)

If the tools suggested by others work for your project, that sounds

If you're going to end up writing an XSLT stylesheet, however, I would
suggest avoiding XSL-FO, which I think is a needless complication.

I'm assuming that when you say "RTF" you're meaning RTF that someone
will open with MS Word. If that's not the case, this advice may not

To convert an XML dialect to Word, I would write an XSLT stylesheet to
convert the XML to WordML, an XML dialect which Microsoft introduced in
Word 2003 Professional. You can then open the WordML as a fully
formatted document in Word. And you can save that as RTF, if you wish.

You can get an idea of how to create WordML from the O'Reilly book,
"Office 2003 XML," by Evan Lenz, Mary McRae, and Simon St. Laurent.

The people who maintain the DocBook XML stylesheets also have
stylesheets for converting DocBook XML to WordML and from WordML to
DocBook. Taking a look at their stylesheets may save you some time. Some
of what they've done is more complicated than you would need since
they're trying to "round-trip" the documents, and you just want to make
a one-way conversion.

The handy thing about taking this route is that you can use Word to do
part of the work. You can create a document template in Word, save it as
WordML, and extract the style and font definitions with your stylesheet.
The DocBook stylesheets show how to do that.

Of course, you have to teach yourself XSLT, but after that, all this is
pretty straightforward.


Dave Nilsson

Current Thread