You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by "Chen, Ben" <bc...@biosignia.com> on 2005/04/06 19:23:38 UTC

FOP and HTML tags

Hi all,

I'm currently having a problem converting HTML to PDF using FOP
(v.0.20.5).  The problem is that although I've defined tags in the
XSL-FO file (ex.

            <xsl:template match="li">

                        <fo:list-item>

                                    <fo:list-item-label
start-indent="3mm">

                                                <fo:block>

                                                            <xsl:if
test="string-length(../@style) = 0">

 
<fo:inline font-family="sans-serif">&#x2022;</fo:inline>

                                                            </xsl:if>

                                                </fo:block>

                                    </fo:list-item-label>

                                    <fo:list-item-body
start-indent="body-start()">

                                                <fo:block>

 
<xsl:value-of select="."/>

                                                </fo:block>

                                    </fo:list-item-body>

                        </fo:list-item>

            </xsl:template>

            )

the result of the PDF document includes the tags as part of displayed
text rather than parsing them as tags.  For example, in the PDF document
I see "<ul><li>test</li></ul>" rather than just *test.  My Java program
does two conversion (we support both an HTML report and a PDF report and
would like to keep both conversions for consistency):  first from XML to
HTML through a XSLT stylesheet and then from that HTML to PDF through a
XSL-FO stylesheet.  Something to note is that if HTML tags are added as
a result from the XML to HTML conversion, then the PDF displays
correctly as a *test.  However, if the tag was present prior to the XML
to HTML conversion (ex. the string text was obtained with tags from the
messagesbundle:  TEST=<ul><li>test</li></ul>) then
"<ul><li>test</li></ul>" appears in the PDF.  Can anyone explain why
these HTML tags are not parsed using the 2nd method and also tell me how
I would get them to be parsed?  I've examined the HMTL content with both
methods (both through the messagesbundle and through adding tags in the
XSLT) before the HTML to PDF conversion and they are identical.  Thanks
for your help in advance :).