RE: [xsl] how to convert HTML to FO

Subject: RE: [xsl] how to convert HTML to FO
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Fri, 19 Sep 2003 23:01:11 +0200
> -----Original Message-----
> From: Biying Huang
> I need to format a java object MyObject to PDF. So I convert MyObject to
> a XML file and write a XSL file to transform the XML data into PDF by
> using FOP.
> One attribute of MyObject is a String representing html source code. In
> my XSL file, how do I convert this html portion to FO so that FOP can
> process it?

Rather depends on the level of complexity of the HTML portion, but...

Looks like this could be solved by:

a. setting up an extra XSLT for the transformation HTML->FO & make sure the
template you are going to use is defined with an <xsl:param ...>
(I'm not sure but I seem to recall running into generic HTML->FO stylesheets

b. referencing this extra XSLT in your original XSL ( via <xsl:include ...
> )

c. perform an <xsl:call-template ...> <xsl:with-param ...> in your original
XSLT and feed it the value of your object's html attribute (or, better even,
the node that contains the HTML portion ... if the HTML is well-formed, it
should be possible to store this as a node in your XML, rather than as an
attribute - pass the node to the HTML2FO-template and make the template
return a FO-node to enter in your resulting document.)

Vaguely sketched, so this method would definitely need a bit of fine-tuning.

Hope this helps.


Andreas Delmelle

 XSL-List info and archive:

Current Thread