[Top] [All Lists]

Re: [xsl] Converting XML into ODT document to print as paper

2020-09-24 08:20:51

To add - for quick and dirty / POC, I concur ODT is probably as good a
target as any and better than most, and as Willem points out, there is a
single-file variant (not zipped) that makes it easier to produce.

I would perhaps start by saving one of these out, and using that as a frame
for a structural mapping.

However, the design intent is somewhat vague (though I think I know what
you mean!) and indeed YMMV when it comes to maintaining "page fidelity" (or
"fixed layout ready to print") depending on what that actually means in the

Where's Eliot? He has vast experience, plus instrumentation that could
(also) be used to do this. For Java programmers there is Apache POI to
think about. I had not seen FlyingSaucer (thank you Christophe). And there
are other routes from HTML+CSS to print/pages, although again at different
levels of maturity and capability.

One question is whether there would need to be hand intervention in the
ODT, HTML+CSS, or other intermediate format, or whether it must be
truly "lights out". That can make a difference.

Cheers, Wendell

On Thu, Sep 24, 2020 at 8:03 AM Christophe Marchand 
cmarchand(_at_)oxiane(_dot_)com <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

HTML + CSS print is usually a good-enough solution. You may have a look to
https://github.com/flyingsaucerproject/flyingsaucer or to one of its fork.

I actually work on a maven-plugin that transform markdown to our
exercise-book odt format, with quite a good result. But it's a very
specific layout, and for now, is not open-source.

Flyingsaucer is probably your solution, as it is already ready-to-use.

Le 24/09/2020 à 10:24, Jean-Paul Rehr rehrjb(_at_)gmail(_dot_)com a écrit :

ready-made solution?

Ready-made solutions usually are domain/standard specific (like TEI-XML
for book editions, etc). But even those usually require certain code-level
interventions to work.

Your data + layout are quite simple and are a good candidate for XSL-FO
<https://en.wikipedia.org/wiki/XSL_Formatting_Objects>:  purpose-made to
handle XML -> PDF outputs.

Alternately, transform your source XML data into Open Office-compliant

On Thu, Sep 24, 2020 at 9:57 AM Manuel Souto Pico 
terminolator(_at_)gmail(_dot_)com <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

Dear all,

I would need to convert XML to something that has a fixed page layout
ready to print, like ODT/OOXML or PDF.

I know OOXML is complex, but since the final document needs to be printed
and keep the same layout, probably HTML output is not good for this (I

What I need at the moment is just a quick and dirty proof of concept to
show that this conversion is feasible and not too difficult, to show it to
decision makers (I'm not a XSLT developer myself).

This is my input (sample):

And this would be my output:


My first thought was to unzip the ODT model I have, look at the
content.xml inside and then try to transform my XML into that same
structure (as suggested here:

However, probably that's the hard way...

I'm doing some research, any tips or pointers or advice or recommendation
or examples here would be highly appreciated. Is there any best practice to
do this? or a ready-made solution?

Thanks in advance.

Cheers, Manuel
XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/3377836> (by

XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/2837134> (by

XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/174322> (by
email <>)

...Wendell Piez... ...wendell -at- nist -dot- gov...
...wendellpiez.com... ...pellucidliterature.org... ...pausepress.org...
...github.com/wendellpiez... ...gitlab.coko.foundation/wendell...
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
<Prev in Thread] Current Thread [Next in Thread>