Stylesheet for xhtml to fo with fop.jar

Posted on 2005-04-06
Last Modified: 2013-11-18

Does anyone know of an xslt stylesheet that will convert xhtml to fo.  I'm using the fo transformation associated with the apache fop.jar.  I've tried the xhtml2fo.xls at, but get a ClassCastException (at  I notice a disclaimer in xhtml2fo.xls - "Since this stylesheet is originally developed by Antenna House to be used with XSL Formatter, it may not be compatible with another XSL-FO processors."


Question by:jkavx
    LVL 15

    Expert Comment

    That link contains more the one XSL to convert XHTML to FO. none of them worked for you? W3C-REC.xsl ?

    Author Comment


    All of these files use xhtml2fo.xsl:

      <xsl:import href="xhtml2fo.xsl"/>

    I'm getting the same error with W3C-REL.xsl:
    ClassCastException (at  
    LVL 15

    Accepted Solution

    There is a bug reported against Apache FO ->

    Author Comment


    I've been able to work around this, by eliminating the xsl use of fo:block-container.

    The main problem I now have is that this stylesheet is meant to be used with the Antenna House XSL Formatter, which seems to handle fo:table table-layout="auto".  The Apache Fo formatter only works with fo:table table-layout="fixed", which will require some reworking of xhtml2fo.xsl.

    Featured Post

    Hire Top Freelancers to Complete Java Projects

    Source the talented Expert Exchange community
    for top quality work on your Java projects.

    Hire the best. Collaborate easily. Get quality work.

    Join & Write a Comment

    Suggested Solutions

    I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    The viewer will learn how to implement Singleton Design Pattern in Java.
    HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now