Hi Jack, This is really an xslt problem (javax.xml.transform. TransformerException) and as such you may find a satisfactory solution by posting to a related mailing list.
A possible solution maybe to download the content locally and resolve the relative urls of the imgs manually. Peter On Mon, Nov 16, 2009 at 7:42 PM, Jack Bates <[email protected]> wrote: > A stylesheet I'm writing includes this template, > > <xsl:template match="html:img"> > <fo:external-graphic src="url('{...@src}')"/> > </xsl:template> > > - but when I process it with FOP I get errors like, > > $ fop -xml index.html -xsl index.xsl index.pdf > [...] > 16-Nov-2009 11:06:32 AM org.apache.fop.events.LoggingEventListener > processEvent > SEVERE: Image not found. URI: > /docs/images/thumb/b/bb/UM-2.1.png/500px-UM-2.1.png. (No context info > available) > [...] > > - and the generated PDF is missing some images > > I built FOP revision 828778 from source > > I think this is because the stylesheet uses the document() function to > get HTML pages from the web, > > <xsl:template match="html:a" mode="foo"> > <fo:block> > <xsl:apply-templates select="document(@href)//html:body"/> > </fo:block> > </xsl:template> > > - and these pages, e.g. http://ica-atom.org/docs/index.php?title=UM-2.1 > > - use some relative images, > e.g. /docs/images/thumb/b/bb/UM-2.1.png/500px-UM-2.1.png > > While the original <img> element is part of the HTML document, and so > relative to http://ica-atom.org/docs/index.php?title=UM-2.1, the > <external-graphic> element isn't? > > So I tried adding an xml:base="" attribute, > > <xsl:template match="html:a" mode="foo"> > <fo:block xml:base="{...@href}"> > <xsl:apply-templates select="document(@href)//html:body"/> > </fo:block> > </xsl:template> > > Here's a simplified, complete example, > > http://www.sfu.ca/~jdbates/tmp/fop/200911160/index.html<http://www.sfu.ca/%7Ejdbates/tmp/fop/200911160/index.html> > > http://www.sfu.ca/~jdbates/tmp/fop/200911160/index.xsl<http://www.sfu.ca/%7Ejdbates/tmp/fop/200911160/index.xsl> > > But when I process this example with FOP I get this error, > > $ fop -xml index.html -xsl index.xsl index.pdf > 16-Nov-2009 11:29:57 AM org.apache.fop.cli.Main startFOP > SEVERE: Exception > javax.xml.transform.TransformerException: > org.apache.fop.fo.ValidationException: Invalid property encountered on > "fo:block": xml:base (No context info available) > at > org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:314) > at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:146) > at org.apache.fop.cli.Main.startFOP(Main.java:174) > at org.apache.fop.cli.Main.main(Main.java:205) > [...] > > Here's the complete stderr, > http://www.sfu.ca/~jdbates/tmp/fop/200911160/stderr<http://www.sfu.ca/%7Ejdbates/tmp/fop/200911160/stderr> > > How can I convert these HTML pages to a PDF with XSL-FO, without > changing the HTML pages? > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
