[NTG-context] DOC/RTF to ConTeXt via XML

Christopher Creutzig christopher at creutzig.de
Wed Sep 28 10:02:03 CEST 2005


Idris Samawi Hamid wrote:
> Ok, you guys have lost me now-) Maybe the best thing to do is try something 

 Just ignore the detail of what xslt can and can't do for the moment.
That just influences the choice of tools for one particular step and we
all agree that there are tools for this step.

> it to ConTeXt. From what I gather so far the process goes something like
> 
> doc  => rtf 
> rtf  => OO.o
> OO.o => xml

 No need for rtf.  That would loose lots of information anyway, wouldn't it?

> \startHans
> converting open office xml is not always easy; stay away from tab's and use 
> high level constructs as much as possible
> \stopHans

 I'm not really sure what Hand meant by this.  I assume he does have a
valid point, since so far I only had a short and theoretical look at the
format, but I can only guess what it is.  Hans, could you give an
example or two?

>>From this discussion it seems that I (as an xml ignoramous) would be better 
> off converting to ConTeXt code rather than processing pure xml blocks (but 
> maybe I'm wrong).

 XML is much, much easier to parse than just about anything else.  That
means that whatever your conversion process uses, you can simply reuse
an XML parser in whatever language you want to use.  (Interpreting the
file may be easy or hard, depending on the xml structure at hand.)  The
only exception I can see right now would be a rather large and
error-prone “Visual” Basic program to create a sort of export filter for
Word to write ConTeXt.  I certainly don't think that's easier.

> Once I get a sane xml file (this seems to be the biggest problem) what is the 
> best tool to convert this to ConTeXt?

 It depends on who is going to write the conversion.  From the languages
I've used so far, it's probably easiest to do in xslt, but if you
are/have at hand a programmer who's good at ruby but would have to learn
xslt first, the whole thing may not be big enough to warrant learning
another language first.  Unless that programmer wants to, which would be
a very good sign.  Learning a new language per year is not really a bad
idea.

> We are all extremely busy, of course, but if anyone finds this interesting I 
> can send a sample doc article from my journal. Maybe we can do a MyWay or 
> something to document this process for ourselves and others, as well as find 

 It might be a pretty specific thing, though.  My guess is that you
could make more progress by thinking about what sort of structurals you
would like to have, rather than looking at what you have right now.


Christopher


More information about the ntg-context mailing list