Questions tagged [xsl-fo]

XSL-FO (XSL Formatting Objects) is a markup language for XML document formatting which is most often used to generate printed content.

From Wikipedia

XSL-FO is part of XSL (Extensible Stylesheet Language), a set of W3C technologies designed for the transformation and formatting of XML data. The other part of XSL is XSLT (Extensible Stylesheet Language Transformations). As of December 12, 2006, the current version of XSL-FO is v1.1.

An XSL-FO document is typically generated using XSLT. An XSLT processor (such as Saxon) evaluates the templates in an XSLT stylesheet to transform your data in your XML vocabulary (or your text or JSON or Markdown or...) into XML in the XSL-FO vocabulary.

Rather than just adding styles to the fixed structure of the source document, the transformation stage is able to also reorder, duplicate, or drop parts of the source document when generating the XSL-FO document, as well as generate new content based on the structure of the source document. This is especially useful when generating tables of contents and indexes that will appear in the formatted document.

The elements in the XSL-FO document represent the formatting objects, and their attributes represent properties of the formatting objects. There are FOs for: blocks; tables and parts of tables; images; links; index entries; and so on. The properties express values such as font size, the expected space between FOs, or whether two FOs should be kept together on the same page. The XSL-FO contains the templates for the types of pages that will be used when the document is made into pages, but the XSL-FO does not contain any information about page breaks or (usually) line breaks.

XSL-FO markup can then be rendered by an FO processor, where it is most commonly used to generate document formats such as PDF, PostScript or RTF. The FO processor uses the structure of the FOs, the constraints expressed by the properties, the sizes of characters in the available fonts, the intrinsic sizes of the graphics, and other factors to lay the content of the XSL-FO out into pages. There is currently one option for viewing the pages in the FO processor application itself, but once the pages are written to a PDF file or other format, the pages can be viewed on screen or printed.

XSL-FO is well suited to applications where you have either a range of broadly similar documents that you want to format in the same style or single large document for which you want consistent styling without much manual effort. The XSLT stage takes care of specifying the right styles for the structures in your source XML and of generating the table of contents and index, and the FO processor automatically lays out the pages in accordance with the specified styles.

Links:

1658 questions
10
votes
3 answers

FOP: fo:block width attribute ignored?

I'm managing to generate a PDF with one line-chart from google-chart, but the quality of the generated columns titles doesn't fit our needs, so I want to generate by myself. This task should be done using [fo:table] but I'm not able to positionate…
ATorras
  • 3,647
  • 2
  • 26
  • 34
10
votes
3 answers

Rotated text in table cell rendered above cell not within

I have the following template to generate a table defined:
Torbjörn
  • 4,822
  • 4
  • 44
  • 70
10
votes
5 answers

Convert Word document to XSL-FO

I am using Microsoft Word 2007. I would like to convert the Word document to XSL-FO. There are some hints on the net, but only for RenderX. Is there such a tool for Apache FOP?
Thunder
  • 9,267
  • 24
  • 75
  • 112
10
votes
2 answers

PDF report with embedded HTML

We have a Java-based system that reads data from a database, merges individual data fields with preset XSL-FO tags and converts the result to PDF with Apache FOP. In XSL-FO format it looks like this:
PM 77-1
  • 11,712
  • 18
  • 56
  • 99
10
votes
2 answers

How to apply space between table rows in XSL-FO?

In my case i have to provide spaces between two table rows upto .5cm.how can i achieve it. code:: I have used: but…
Amit Kumar
  • 1,295
  • 5
  • 18
  • 45
10
votes
1 answer

FOP XSL-FO Anchor in an external destination

With XSL-FO (Fop), I succeeded in creating a link to an external PDF : foo.pdf But now, I would like to reach an anchor in this…
Johann
  • 437
  • 2
  • 7
  • 23
9
votes
1 answer

Using XSLT to create XSL-FO with nested bold/italic tags

I'm creating xslt file, which should convert my xml into xsl-fo. XML is something like that: some text Of course, there are many paragraphs and points in document. I would…
dce
  • 93
  • 1
  • 1
  • 3
9
votes
2 answers

Cakephp Security

I am new to Security of Web apps. I am developing an application in Cakephp and one of my friends told me about the Cross-site request forgery (CSRF) and cross-site scripting (XSS) attacks etc. not sure how many more are there. I need some help in…
Harsha M V
  • 50,335
  • 109
  • 326
  • 496
9
votes
2 answers

xsl:fo inline line wrap and line break

I'm struggling with my xsl:fo (Apache Fop 1.1). I'm trying to generate a Block with inline images and inline text elements which might contain newline characters. First Line Second Line, Image:
Kai
  • 752
  • 1
  • 13
  • 31
9
votes
2 answers

Does xslt-fo not support utf-8?

I have an xml file in utf-8 with an encoding attribute. When I execute fop -xml xml.xml -xsl xsl.xsl -pdf pdf.pdf, my output pdf has broken utf-8 characters. What is important, the text from xsl file is without utf-8 characters, same as the text…
user3050705
  • 407
  • 1
  • 5
  • 12
9
votes
3 answers

Best way to create PDF from XML XSLT in C#

I have a requirement to crate a PDF of XML Records. I think there is no way to directly create pdf from xml but using XSLT or XSL FO i believe it can be done. I have been reading lots of articles searching for the good way to do that using C#. -->…
Bravo11
  • 848
  • 2
  • 10
  • 23
9
votes
1 answer

xsl:fo different colors/fonts in one block

Suppose I have an xsl:fo block: one two three Can I make "three" a different color than "one" and "two"? Note: I'd rather NOT use a table for this.
Ya.
  • 1,385
  • 1
  • 22
  • 46
9
votes
4 answers

Is there an alternative to "keep-together='always'" on table-row?

Upon finding the "keep-together" attribute, and needing to not page break inside a row I added keep-together="always" on every table-row element in my xslt. Is there a nicer way of achieving the same effect? It seems a bit hacky. (ps. I will accept…
Sean
  • 646
  • 2
  • 9
  • 23
9
votes
4 answers

XML to TeX or how to get a beautiful PDF from XHTML-like source

Superficially, an easy question: how do I get a great-looking PDF from my XML document? Actually, my input is a subset of XHTML with a few custom attributes added (to save some information on citation sources, etc). I've been exploring some routes…
mb21
  • 28,026
  • 6
  • 96
  • 118
8
votes
2 answers

How to set the default language in Apache FOP

I'm generating PDF files using Apache FOP 2.1. For this I am trying to set the default language to be English. This is supposed to be verified after the creation of the PDF via Adobe Reader's option File/Properties/Advanced/Reading Options. This…
Dimitris
  • 2,937
  • 4
  • 21
  • 27