XSL-FO or HTML/CSS

Post here questions and problems related to editing and publishing DITA content.
InspectorSpacetime
Posts: 37
Joined: Thu Jul 29, 2021 12:02 pm

XSL-FO or HTML/CSS

Post by InspectorSpacetime »

Hello,

This might be a newbie question, but I couldn't really find a good answer, so here goes:

Regarding publication from XML to PDF, I was wondering in what situations should you use XSL-FO over HTML/CSS? I understand the technical differences pretty well, but in practical terms I'm a bit confused about the advantages and disadvantages of each approach? Are there any good rules of thumb or such to decide which one to use?

I assume that if you plan to publish the same content in HTML as well, it's probably convenient to use HTML/CSS, since you can use the same CSS files for both publications?

But if I'm planning to publish just in PDF, is XSL-FO preferred? If yes, why? Or why not? Is it just a matter of preference?
julien_lacour
Posts: 481
Joined: Wed Oct 16, 2019 3:47 pm

Re: XSL-FO or HTML/CSS

Post by julien_lacour »

Hello,

This is not a newbie question, in fact it's a quite relevant one.
The fastest answer I can give is: it depends, you can use either one or another method to generate PDFs without any problem.

Now come the detailed answer, why choose one instead of another?
  • If you do not know both XSLT or CSS, you may better use CSS as it is a much easier language than XSLT
  • It will be easier also to find people with CSS knowledge rather than XSLT knowledge
  • You can use the browser or Oxygen in order to debug the CSS (by using the intermediary merged.html file)
  • If you want really pointy details in your output, you will need to use XSLT which will allow you to modify the smallest things, but in most cases the CSS coverage is enough.
  • As you mention you can reuse your CSS customization for WebHelp Responsive output for example
  • Currently PDF processor tend to use CSS instead of XSLT (Oxygen PDF Chemistry, Antenna House, Prince XML, etc...)
I hope you can see clearer now through the PDF generation :wink:

Regards,
Julien
Post Reply