XML
  Home arrow XML arrow Page 3 - Using XSL Formatting Objects
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
XML

Using XSL Formatting Objects
By: Peyton McCullough
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-02-04

    Table of Contents:
  • Using XSL Formatting Objects
  • Creating a Hello world document
  • Processing a document
  • Page masters

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using XSL Formatting Objects - Processing a document


    (Page 3 of 4 )

    Of course, by itself, the document is worth nothing. Recall that a processor such as Apache FOP is needed to process the document into a more meaningful format. Let's make our "Hello world" example into a PDF document. Go ahead and download the latest version of Apache FOP:

    http://xmlgraphics.apache.org/fop

    Converting the raw XSL-FO file into a PDF file is incredibly simple. Simply run the following command; a PDF file named helloworld.pdf will be created:


    fop helloworld.fo helloworld.png


    The document can be processed in a number of other ways as well. We could, for example, output a file in rich text format:


    fop helloworld.fo -rtf helloworld.rtf


    Or we could generate an image:


    fop helloworld.fo -png helloworld.png


    To view a more complete list of possible output formats, check the documentation or type "fop" without any arguments at the command line. Just keep in mind that some of these formats won't take advantage of all the functionality that XSL-FO provides. A PDF file is a lot more suited to paged data than a PNG image.

    One of the most useful things to do, however, is to immediately display the resulting document on the screen. This can easily be done using Apache FOP:


    fop helloworld.fo -awt


    The processor isn't limited to simple FO-to-output operations. Recall that formatting objects were designed to be used with XSLT and XML data. It's possible to use another program such as Saxon to generate formatting objects from an XML document and an XSLT stylesheet, but Apache FOP can actually combine these steps. That is, you can specify an XML file and an XSLT stylesheet, and it can output a PDF file. We'll take a look at this later.

    More XML Articles
    More By Peyton McCullough


     

    XML ARTICLES

    - Using Regions with XSL Formatting Objects
    - Using XSL Formatting Objects
    - More Schematron Features
    - Schematron Patterns and Validation
    - Using Schematron
    - Datatypes and More in RELAX NG
    - Providing Options in RELAX NG
    - An Introduction to RELAX NG
    - Path, Predicates, and XQuery
    - Using Predicates with XQuery
    - Navigating Input Documents Using Paths
    - XML Basics
    - Introduction to XPath
    - Simple Web Syndication with RSS 2.0
    - Java UI Design with an IDE







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek