Search code examples
htmlxmlapache-fop

Convert HTML present in XML into formatted displayable content to finally go into PDF rather than stay as tagged html


I'm using FOP to convert XML into a PDF. One of the fields that we have is a rich text field that returns content in HTML. So when the XML is generated, the field will be BOLD]]>

I want to convert this into a displayed bold [The text is BOLD] rather than my PDF containing The text is <b>BOLD</b> in that particular section.

What is the easiest way to achieve this?


Solution

  • The solution that we found for this problem was to a double transformation.

    Extract the html from the XML, apply an appropriate XSL on that html to get FO, then merge this FO into the main XSL, and apply the merged XSL onto the original XML to get the final PDF.

    The html to fo xsl was from the IBM article: http://www.ibm.com/developerworks/library/x-xslfo2app/