Why is XSL-FO popular?

I am going to create a converter from html to some format. I am thinking of using an intermediate format XML format (XSL-FO).

My question is: why is popularity popular in FO format if there aren’t so many applications?

+4
source share
4 answers

I am well aware that there is much debate between CSS and XSL-FO supporters, and both sides have valid and good points.

Here is the best brief argument for XSL-FO I've seen so far:

XSL-FO provides a more sophisticated visual layout model than HTML + CSS. Formatting is supported by XSL-FO, but not HTML + CSS, includes right-to-left and top-to-bottom footnotes, margin notes, page numbers in cross-references, etc. In particular, while CSS (Cascading Style Sheets) is primarily intended for use on the Internet, XSL-FO is intended for wider use. You should, for example, be able to write an XSL stylesheet that uses formatting objects from the entire printed book. a stylesheet must be affixed to convert the same XML document to a website.

(Source: http://www.cafeconleche.org/books/bible2/chapters/ch18.html )

Here are some XSL-FO arguments that are superior:

Although some say CSS is better:

+6
source

Both RenderX and Antenna House create superior XSLFO-> PDF visualization tools. There is also free rendering [Apache FOP], which is good enough for many projects. Serious effort is required to fully support FO in every detail; perhaps the entry bar is too high based on the size of the market, established players and potential returns.

Not what you asked, but before you do too much work with HTML FO , there are some free options that can save you a bit of effort.

+1
source

Have you checked the Ecrion XSL-FO engine ? The boss chose it because it supports many output formats (PDF, Word, PowerPoint, Postscript, HTML and the very cool Silverlight output mode), and he has an incredible designer (as far as I know, this is only one that can work with other mechanisms formatting, including FOP). The problem with using HTML to create a PDF is this:

  • HTML doesn't allow you to control pagination (for example, have different layouts on even / odd pages, just like a book or catalog).
  • You cannot control the headers and footers.
  • There are no instructions for creating links to page numbers, footnotes, inserting the number of pages and many other things that print media may have.

Additional engines such as Ecrion, Antenna and Renderx can also create high-quality PDF files (such as PDF / A for archiving or PDF / X for printing).

+1
source

XSL-FO is a common standard that tool developers can implement for compatibility, just as HTML is a common standard for web pages, XSL is a standard for XML-to- * conversion, etc.

If your HTML can be considered well-formed XML (i.e. short tags close properly, for example, <br /> and <img /> - not <br> and <img>), then you should be able to use XSL to translate directly to XSL-FO, which can then be transferred directly to a tool, such as Apache FOP for conversion. If it is not correct, you can always use the Python BeautifulSoup tool or PHP DOMDocument :: loadHTML () to load HTML and output well-formed XHTML for your conversion.

There are also tools like FPDF (PHP) and Prawn (Ruby, which was used for very nice Dopplr reports ), but IMHO they are much more "fiddly" to use - more like using absolute positioning in CSS than letting things flow on their own. May cause problems when considering page breaks, etc.

However, it all depends on what you do with the exit.

0
source

All Articles