Hello,
i use FOP in a servlet together with the Saxon XSL processor.
I implemented the communication between the processors as
a SAX event stream. The following code snippet was developed
with FOP 0.20.1, i think with 0.20.2 i could use the Driver
again but i don't want to bother with this yet.

      Transformer transformer=getTransformer(xslFile);
      // setup FOP
      org.apache.fop.system.BufferManager bufferManager
        =new org.apache.fop.system.BufferManager();
      org.apache.fop.fo.FOTreeBuilder treeBuilder
        =new org.apache.fop.fo.FOTreeBuilder();
      treeBuilder.setBufferManager(bufferManager);
      org.apache.fop.fo.ElementMapping mapping;
      mapping=(org.apache.fop.fo.ElementMapping)Class.forName(
           "org.apache.fop.fo.StandardElementMapping").newInstance();
      mapping.addToBuilder(treeBuilder);
   [ more mapping code lifted from Driver.java snipped ]
      org.apache.fop.apps.StreamRenderer streamRenderer
         = new org.apache.fop.apps.StreamRenderer(out,
              new org.apache.fop.render.pdf.PDFRenderer());
      treeBuilder.setStreamRenderer(streamRenderer);
   [ setting up log snipped - a nightmare! ]
      // the transformer gets its input data wia a customized XMLReader
      // from the servlet parameters
      transformer.transform(new SAXSource(new DocXMLReader(),
              new DocServletParameterInputSource(req)),
                            new SAXResult(treeBuilder));

      byte[] content = out.toByteArray();
      res.setContentType("application/pdf");
      res.setContentLength(content.length);
      res.getOutputStream().write(content);
      res.getOutputStream().flush();

The problem i want help about is the exception
[ERROR]: Could not set base URL for svg
java.net.MalformedURLException: no protocol:
        at java.net.URL.<init>(URL.java:473)
        at java.net.URL.<init>(URL.java:376)
        at java.net.URL.<init>(URL.java:330)
        at org.apache.fop.svg.SVGElement.layout(SVGElement.java:143)
        at 
org.apache.fop.fo.flow.InstreamForeignObject.layout(InstreamForeignObject.java:198)
        at org.apache.fop.fo.flow.Block.layout(Block.java:259)
Fortunately, the file renders fine, the missing information is
aparently not needed.
The SVG is defined in the XSL file. How do i set the base URL for
the SVG element, just in order to pacifiy the software? Should i use
a real file name (for example the name of the XSL file) or is it
sufficient to use ""?


J.Pietschmann

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to