On Sun, Mar 17, 2002 at 10:05:16PM +0100, Florian Kohl wrote: > > sorry if this has already been covered but I could not find > anything on google about this, > > I have an xml document that I want to convert to lyx, > what would be the easiest approach to do so? > > >
Funny, but I am working on this same exact problem right now. I have learned perl just for this purpose. I joined an xml-perl mailing list. Below is a copy of an email I sent to this mailing list and the response. If you want, I'll update you with my progress. I think it is definitely something people should look into--I mean, converting XML to LaTeX. Paul **********************************************8 Paul Tremblay wrote: >Specifically, I have files in xml that I want to convert to >LaTeX. > [...] >I am assuming that XML::Parser is the module I >should use. However, I have seen that there are several modules >out there (for example, the DOM module). Should I also be looking >at what these modules do? > Have you tried XSLT? It's primarly used for XML->XML transformations, but with an <xsl:output method="text" /> at the top, it can do XML->LaTeX. Advantage: XSLT is familiar to most people who deal with XML. There's just the stylesheet and a very few lines of Perl (with the XML::LibXSLT module or whichever you prefer). In fact, this might be heresy here, but it would be just as easy to run with even a non-Perl XSLT processor. Disadvantage: It loads the entire document into memory before doing anything. I think incremental XSLT processors are possible, but I've never seen one. This is not a big deal for small documents, but may be for large ones. If not that, then XML::SAX might be a good choice. Get a parser with XML::SAX::ParserFactory (or specify one explicitly), derive a package from XML::SAX::Base, override stuff appropriately. It's the same concept as XML::Parser, but better for reasons explained in XML::SAX::Intro. It is incremental, if that matters to you. (I've been playing around with this lately. Seems fairly easy.) -- ************************ *Paul Tremblay * *[EMAIL PROTECTED]* ************************