Home | Business News | Browse by Publication | X | XML Journal

Got XSLT? How to transform XML to PDF using FOP. (xslt tutorial).

Publication: XML Journal
Publication Date: 01-APR-02
Format: Online - approximately 3657 words
Delivery: Immediate Online Access

Article Excerpt
As a substitute for handcrafting, most word processing and desktop publishing tools lack the capability to produce the detailed design and sophistication that normally accompany high-end page layouts. And companies, of course, are always looking for the most cost-effective way to deliver documents of consistently top-quality appearance.

What's needed is a powerful software that automates the process entirely and possesses capabilities far beyond those found in today's tools. Unfortunately, a document that's transformed using XSLT may be presentable, but it's not really ready for the type of report or presentation we're aiming for here. To be specific, printed reports often require properties or instructions that aren't included with the XML document and aren't provided by XSLT. At a minimum, an advanced formatting engine or processor must provide:

* Support for header/footer specifications and page number generation/ placement in the page layout

* Support for page layout descriptions, including different left, right, and blank page layouts

* Support for multiple columns on a page

* Flexibility to specify min/max/optimum values for page margins

* Fonts, highlighting (foreground/background colors, underscoring, all capitals)

* Support for justification and page breaks

* Support for tables, lists, and external graphics linking, including autoscaling

Introducing XSL-FO

XSL Formatting Objects is an XML-based markup language that specifies formatting semantics for high-quality documents. XSL-FO is basically a style specification designed to provide detailed layout-control devices and format-independent requirements.

The World Wide Web Consortium's specification for XSL comes in two parts (see Figure 1):

* XSLT: A language for transforming XML documents to other formats such as XML, HTML, and WML

* XSL-FO: A language for specifying format semantics

[FIGURE 1 OMITTED]

Thus XSL = XSLT + a vocabulary of FOs and properties.

It's only fair to warn you that XSL-FO is more complex and bigger than XSLT, and because of that, it isn't widely used or supported by your browser or other software tools at this time. In fact, as far as I know, no implementation of XSL-FO is near the complete standard.

FOP (the Apache FO-to-PDF project) is one such implementation of the XSL-FO specification. FOP is the world's first print-and output-independent formatter (as claimed by the Apache XML project) that's driven by XSL-FO and compliant to at least the basic conformance level described in the W3C Candidate Recommendation of November 21, 2000, and that complies with the March 11, 1999, Portable Document Format Specification (version 1.3) from Adobe Systems.

FOP is a lava application or library that converts an XSL-FO document into paginated output. FOP supports several output formats such as printer formats (HP PCL, PostScript), PDF, print (hard copy output printed directly), and SVG (I'll explain that later). The main target, however, is PDF. FOP can be run from the command line or embedded in your lava application.

As we've seen in previous articles, the most common use of XSLT is to transform XML into HTML; the most common use...

View this article FREE - Now for a Limited Time, try Goliath Business News
Free for 3 Days!



More articles from XML Journal
`No programming' import/export tool from HiT Software. (XML News).(win..., April 01, 2002
SilverStream, Queotek Solutions in strategic partnership. (XML News).(..., April 01, 2002
eNode releases Xalt Object Realizer. (XML News).(Brief Article), April 01, 2002
XML Global receives GSA approval. (XML News).(Brief Article), April 01, 2002
Corda Technologies updates PopChart. (XML News).(PopChart 4.0)(Brief A..., April 01, 2002

Looking for additional articles?
Search our database of over 3 million articles.

Looking for more in-depth information on this industry?
Search our complete database of Industry & Market reports by text, subject, publication name or publication date.

About Goliath
Whether you're looking for sales prospects, competitive information, company analysis or best practices in managing your organization, Goliath can help you meet your business needs.

Our extensive business information databases empower business professionals with both the breadth and depth of credible, authoritative information they need to support their business goals. Whether it be strategic planning, sales prospecting, company research or defining management best practices - Goliath is your leading source for accurate information.