The GnuCash
XML data file can be transformed to almost any other data
format (e.g., QIF, CSV...) quite easily if one is familiar with XSLT.
The GnuCash
data file is well-formed XML, and it can therefore be run
through an XSLT parser with an associated stylesheet. This allows one
to transform the file to just about any format that can be designed,
given a properly written stylesheet.
A few steps need to be followed. The writing of a stylesheet is a task for a different time, but if you can get one written, here’s what you need to do:
Copy the GnuCash
XML data file to a working file.
Note | |
---|---|
If the file was last modified by a version of
You can put pretty much anything you want behind the equal signs, but a URL is what is typically used. |
Create an XSLT stylesheet containing the transformation your desire, or obtain one that’s already written (AFAIK, there aren’t any, but I’m working on a CSV one).
Install an XSLT processor such as Saxon (http://saxon.sourceforge.net/) or Xalan-J (http://xml.apache.org/). Any conforming processor will do, really...
Run the work file and the stylesheet through the processor according to the processor’s instructions.
You will now have a file in the desired output format. An
enterprising individual could go so far as to write a stylesheet to
transform the GnuCash
data file to an OpenOffice spreadsheet (or
vice-versa, for that matter). Such things as QIF ought to be a little
less work.
Benefits are that you don’t need to write a Scheme module or a new C routine to do this transformation. Anyone who knows or can learn XML and XSLT can perform this task. Not much harder, really, than writing a Web page....
Anyhow, I just wanted this tidbit to be captured somewhere permanently. The process works on 2.4.3 datafiles, and ought to work on earlier versions, too.