Translatable XSL stylesheets for QSF

Neil Williams linux at codehelp.co.uk
Wed Mar 8 06:52:47 EST 2006


I'm building a collection of XSL stylesheets for QSF data in pilot-qof and 
gnucash/cashutil.

Each gnucash stylesheet will use standard templates from the XSLTSL project 
(LGPL) and our own common stylesheet, gnucash-std.xsl.
http://xsltsl.sourceforge.net/

So far in gnucash, I've just got a sample xsl that transforms 
Export->Customers QSF into vcard format, one per gncCustomer. "Chunking" is 
supported so individual customers can be written as separate files into a 
directory. These vcards can be imported into KAddressbook without errors or 
omissions, but haven't been tested in other programmes. Now I need to work on 
the reverse - that'll depend on how easily I can generate a temporary GUID in 
XSL to link a gncCustomer to a gncAddress etc.. A similar stylesheet could 
then transform pilot-qof address records into gncCustomer records.

The next pilot-qof release will also have a stylesheet to convert 
pilot_address records into more limited vcard files that are suitable for 
upload to mobile phones - e.g. via bluetooth. gnucash could have a similar 
stylesheet. This process ignores a lot of data from the original QSF because 
phones use such limited vcards so this is likely to be a one-way 
transformation. It should mean that users can choose to enter their customer 
data in a Palm or into gnucash and then share that data with gnucash, a Palm, 
existing address books and their mobile phone without re-entering it.

This is what http://www.data-freedom.org/ is all about.
:-)

Support for transforming kaddressbook vcards into pilot-qof pilot_address or 
gnucash gncCustomer QSF could follow. Support for iPAQ's and other data 
sources is possible too.

I'd like these in svn and installed, probably into /usr/share/xml/gnucash/xsl 
to complement the pilot-qof ones in /usr/share/xml/pilot-qof/xsl. In due 
course, I'll package XSLTSL for Debian so that the xsltsl standard 
stylesheets don't have to be installed by each programme (at least on 
Debian). These would go into /usr/share/xml/xsltsl/ and be referenced by the 
gnucash and pilot-qof ones.

The stylesheets are gnucash-specific (only deal with gnucash QFS objects) and 
hence shouldn't go into lib/libqof/ but into a new directory. A new top-level 
directory xsl/ ? doc/xsl/ ? 

date-time.xsl  
string.xsl
gnucash-customer-vcard2.xsl  (denotes that the vcard is version 2.1)
gnucash-std.xsl  

I don't envisage gnucash loading these stylesheets at runtime, these are 
primarily for users.

I'm planning more stylesheets, including HTML and ics output. I've already got 
a prototype pilot-qof HTML invoice. A gnucash version would mean that by 
exporting invoices to QSF, users can generate whatever invoice format they 
require, simply by copying the default XSL to a local directory, tweaking it 
and passing it to xsltproc. I aim to keep as much of the transformation 
jargon in gnucash-std.xsl as I can so that each stylesheet is as easy to 
amend as possible, without causing chaos in the output. Modifying the output 
could be as simple as changing the xsl:output type and modifying some 
<xsl:text> or HTML tags.

All XSL output strings will be available for translation using --stringparam 
parameters that can be passed via scripts to replace the en_GB defaults with 
translated versions, e.g. for the words "Invoice", "Date", "Description" etc. 
as well as supporting other parameters to handle HTML lang values, encoding 
strings, default values for calculations, like mileage rates, hourly rates 
etc.. This makes for very long command lines so scripts are advisable.

If the XSL is processed via PHP, Perl or bash, it should be possible to read 
the existing translation files for some of this data - not sure how easy that 
will be in reality.

All HTML output will be HTML 4.01 Strict compliant. An example CSS stylesheet 
will be included and the HTML will include lots of CSS hooks.

$ xsltproc -o ~/data/cards/ \
 /usr/share/xml/gnucash/xsl/gnucash-gnccustomer-vcard2.xsl \
 /opt/data/g2/test-1-customer.xml

All stylesheets outside xsltsl will be licenced under the GPL.

-- 

Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20060308/b926cec7/attachment.bin


More information about the gnucash-devel mailing list