Q&A
Are XSL-FO documents usually coded by hand?
No. In fact, XSL-FO is intended to be generated automatically using a transformation language such as XSLT. In a real-world scenario, you would likely use XSLT to automatically transform an XML document into an XSL-FO document, and then use an XSL-FO processor to generate a PDF document automatically. All these steps would take place behind the scenes without any manual involvement. In this lesson I showed you the "brute force" method to creating an XSL-FO document by hand and converting it to PDF so that you could better understand how the XSL-FO language works.
Should I consider switching from CSS to XSL-FO to style my XML documents?
It depends entirely upon your specific circumstances. If you're talking about styling XML documents for the web, the answer is currently a resounding no. There just isn't enough XSL-FO browser support to consider it a viable web technology at the moment. However, if you're talking about styling XML content for print, XSL-FO may very well be a good option as a high-powered replacement for CSS.
Workshop
The Workshop is designed to help you anticipate possible questions, review what you've learned, and begin learning how to put your knowledge into practice.
Quiz
1. |
How does XSL-FO relate to CSS? |
2. |
What are the XSL-FO equivalents of the |
3. |
How do you validate an XSL-FO document? |
Quiz Answers
1. |
XSL-FO is a functional superset of CSS but an entirely separate technology. Unlike CSS, XSL-FO is used to code entire documents including both content and formatting, whereas CSS is designed purely for applying formatting styles to existing documents. Also unlike CSS, XSL-FO is an XML-based language, whereas CSS relies on its own unique syntax. |
2. |
The XSL-FO equivalents of the |
3. |
To validate an XSL-FO document, you currently must reference the RenderX experimental XSL-FO DTD in the document, and then pass the document through the standard W3C Markup Validation Service ( |
Exercises
1. |
Develop an XSLT stylesheet to transform an existing XML document into an XSL-FO document. |
2. |
Feed the newly generated XSL-FO document into FOP to generate a PDF of the resulting formatted XSL-FO document. |