xsl-list
[Top] [All Lists]

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

2020-09-28 09:40:00
When you follow the XML -> XSLT -> HTML + CSS/JS path, you can still print
to PDF
There is potentially some manual work required, but it is a quick and easy
fix if the volume is "reasonable".
Other paths may be more appropriate in most cases.


Le ven. 25 sept. 2020 à 07:32, Manuel Souto Pico 
terminolator(_at_)gmail(_dot_)com <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> a écrit :

Thank you so much everyone for all the suggestions. They help a lot, I
have what I needed.

In the end it seems my initial idea (ODT output) is not the best approach
at all.

Some clarification: I don't need the final document to be modified. I said
ODT/OOXML because I assumed it's easier to convert to that than to PDF. And
ideally there should be no hand intervention other than for printing, so a
final-final result out of the pipeline.

So it seems these are my options:
* XML -> XSLT -> FODT -> PDF
* XML -> XSLT -> HTML + CSS/JS ( and print directly, I suppose)
* XML -> XSL-FO -> PDF
* XML -> XSLT -> LaTeX -> PDF

Some good pointers to things worth exploring:
* https://www.pagedjs.org and aged-media CSS (new to me)
* XSL-FO (I had heard about it before)

Also very interesting (but more specific and perhaps more advanced for my
meager CSS skills):
* https://vivliostyle.org/
* https://github.com/flyingsaucerproject/flyingsaucer

Open/Libre Office also has a single-file XML format that you can use
for this purpose.

I saw that LO's Writer can save as a FODT (F stands for "flat xml"), I
guess this is what you Willem and Wendell meant (thanks for that!). I
easily created a quick and dirty template in XSL to produce a FODT which
looks quite good, so that's the trick as PoC. Probably it shouldn't be too
difficult to convert to PDF without having to open the file in LO, but
that's fine.

LaTeX

I know some LaTeX and I used it to craft my thesis and my cv (
http://msoutopico.es/cv). It would have never crossed my mind that it
could be used for this, but it doesn't seem a bad idea at all! Good tip,
thanks Peter! (And great sample, you nail it).

Thank you again. Have a great weekend.
Cheers, Manuel




Peter Flynn peter(_at_)silmaril(_dot_)ie 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com>
escreveu no dia quinta, 24/09/2020 à(s) 17:25:

On 24/09/2020 08:57, Manuel Souto Pico terminolator(_at_)gmail(_dot_)com 
wrote:
I would need to convert XML to something that has a fixed page layout
ready to print, like ODT/OOXML or PDF.

Do you want other people to be able to edit the result? ODT/OOXML are
designed to be editable; PDF is not.

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 guess!).

A good web designer can probably create a layout that looks the same and
honours the paged-media CSS, but I don't think there are any guarantees.

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).

XSLT will certainly be involved IMNSHO. My personal preference would be
XML > LaTeX > PDF but not everyone knows LaTeX.

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:

https://stackoverflow.com/questions/38298174/directly-convert-a-single-xml-file-to-docx).


That is indeed possible. Just complicated.

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

You spotted it :-)

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?

I did a quick test just now and the results are at
http://xml.silmaril.ie/software

Peter

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

--~----------------------------------------------------------------
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>