Re: [xsl] XSL-FO plain text processor?

Subject: Re: [xsl] XSL-FO plain text processor?
From: Kai Hackemesser <kaha@xxxxxx>
Date: Sat, 14 Jul 2007 20:54:19 +0200
Hi, J.

Thanks for your additional information! I just wondered what strange format they use for their grid. 8LPI, that's just a line hight of 2.5mm, that's quite tiny I would say. A usual line printer wouldn't print that small by default, but it explains why a DIN A4 page format results in about 110 rows. But anyway, your numbers will help me to format the page as desired, since I can now do some math in the master stylesheet. Thanks!

Ciao!
Kai

J.Pietschmann schrieb:
Kai Hackemesser wrote:
I'm looking for a solution to create a formatted plain text file from XML. Currently I try apache FOP Processor with XSL-FO input. but I can't get it looking as I want, I always have misformations, missing or to much spaces or empty rows, even clipped characters. I would like to know if you know any alternatives to that?

The FOP text renderer tries to snap the characters to a fixed grid, defined by hard-coded lines-per-inch (8) and chars-per-inch (16.67) constants. Obviously, this will only work for a fixed font (e.g. courier), a certain line-height and an appropriate font-size. 8 LPI translate to an line-height of 0.125in, which should be set explicitly. The font size should be a little smaller and hopefully match the CPI, you should try a setting around 8pt (I'm too lazy to check the Courier metrics right now, it's bed time).

Alternatives to using XSLFO are using XSLT to convert the XML into
text directly as already mentioned, which is a bit tedious in case
of tables and right justified text, and using XSLT to convert to
nroff source and let nroff/groff do the grunt work.
Someone mentioned http://sourceforge.net/projects/xml2txt/

J.Pietschmann

Current Thread