[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] XSL:FO approach for facing-page translation

Subject: Re: [xsl] XSL:FO approach for facing-page translation
From: Martin Holmes <mholmes@xxxxxxx>
Date: Fri, 7 Feb 2014 13:41:54 -0800

On 14-02-07 12:57 PM, Tony Graham wrote:
On Fri, February 7, 2014 6:43 pm, Martin Holmes wrote:
I need to do something similar in PDF, using XSL:FO. The ideal would be
to have the original text on the verso page, with the equivalent
translation on the facing recto. But I can't figure out a practical
approach to this. For one thing, I don't see how I can render individual
pages from one text and then the other text in alternating fashion, and

Flow maps from XSL 1.1: use different flows on recto and verso pages.

Unfortunately I'm using XEP, which doesn't appear to support flow-maps.

for another, I don't see any way to keep the two texts in sync. I can
disallow page-breaks within paragraphs, but I'd have to be
extraordinarily lucky for the two texts to end up breaking at the same
points every time; it would just take one slightly-shorter paragraph on
one side to put them out of sync by a paragraph. Such a strategy would
also be rather a paper-waster, because many pages would have a lot of
blank space at the bottom.

Has anyone every done anything like this, and if so, do you have any
advice? I can imagine that it might be done in a horribly manual fashion
by trial and error, working page-by-page, but I really don't want to get
into that. I'm happy to pre-process the text multiple times before it
goes to the XSL:FO stage., Perhaps there are ways to measure (for
instance) how much space a paragraph will take, and then adjust
page-margins or spacing by small increments to preserve alignment
between the two texts, but I haven't seen examples of such an approach.

See my Balisage 2013 talk, 'Decision making in XSL-FO formatting' [1].

I've just been looking at it -- very intriguing.

The Print and Page Layout Community Group @ W3C [3] has an extension
function for use with Saxon or Xalan and either FOP or Antenna House that
runs the XSL-FO formatter within the XSLT transform so you can make
decisions based on formatted sizes as you go.  That would give you the
flexibility to format each paragraph pair in turn to work out their sizes,
which could make things simpler or harder, depending on how you approach

This does seem very promising, but the rest of the web application I'm working with is dependent on XEP, and I don't think FOP yet supports some of the features I'm depending on XEP for (although it's a good while since I've done a detailed test of this). I have no funding to buy into the AH Formatter (and the price is frankly jaw-dropping for an academic user) so it would have to be FOP.

I'm beginning to wonder about a far cruder approach: render both languages and see which is longer, then implement hard page-breaks in both versions at the point the longer one would break. Then run XSLT to interleave the two versions to create a continuous document. Very fragile, of course, and likely to require a lot of tinkering, but it would work.



Tony Graham tgraham@xxxxxxxxxx Consultant http://www.mentea.net Chair, Print and Page Layout Community Group @ W3C XML Guild member -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Mentea XML, XSL-FO and XSLT consulting, training and programming

[2] http://www.w3.org/community/ppl/wiki/FOPRunXSLTExt
[3] http://www.w3.org/community/ppl/

Current Thread