xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jack Bates <ms...@freezone.co.uk>
Subject xml:base
Date Mon, 16 Nov 2009 19:42:49 GMT
A stylesheet I'm writing includes this template,

  <xsl:template match="html:img">
    <fo:external-graphic src="url('{@src}')"/>

- 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">
      <xsl:apply-templates select="document(@href)//html:body"/>

- 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"/>

Here's a simplified, complete example,



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,

How can I convert these HTML pages to a PDF with XSL-FO, without
changing the HTML pages?

To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org

View raw message