First of all, I'm using 0.20.5 still... I'll switch over as soon as svg works in the new builds :)

I started refactoring some of my reports stuff and it took me some effort to get the Transform class hooked up and working correctly. Now my xsl/fop transformation is working great, but I've run into a snag with embedded svg elements. Fop is reporting:

[ERROR] Unsupported element encountered: svg (Namespace: default). Source context: unavailable
and 
[ERROR] no handler defined for svg foreign xml


also, the tranformer was throwing a NullPointerException. I read the blurb in the FAQ about problems that cropped up in the 0.92 beta related to a bug in xalan and batik... so I followed the suggestions about grabbing the new xalan and stuck it in /lib/extended (after confirming replacing the copy in my class path wasn't enough).... The NPE dissapeared, but I still have the fop complaints and no svg images rendered.

I tried putting the latest version of batik in /lib/extended also.. no dice.


Does anyone have any suggestions? Below is my java code, the resulting fo (svg internals abbreviated, but should parse), and the fop output.

Thanks in advance,
Phill


DocumentBuilderFactory bf = DocumentBuilderFactory.newInstance();
bf.setNamespaceAware(true);
DocumentBuilder builder = bf.newDocumentBuilder();
Document xslDocument = builder.parse("reports/src/com/intellidot/reports/presentation/DrawListReportXMLtoFO.xsl");
Document drawListXML = builder.parse("reports/tests/com/intellidot/reports/presentation/SampleDrawList.xml");

DOMSource xslSource = new DOMSource(xslDocument);
TransformerFactory factory = TransformerFactory.newInstance();
Transformer t = factory.newTransformer(xslSource);
Driver fopDriver = new Driver();
ByteArrayOutputStream out = new ByteArrayOutputStream();
    fopDriver.setOutputStream(out);
fopDriver.setRenderer(Driver.RENDER_PDF);

Result result = new SAXResult(fopDriver.getContentHandler());

    //Start the transformation and rendering process
t.transform(new DOMSource(drawListXML), result);



<?xml version="1.0" encoding="UTF-8"?><fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:dotgen="xalan://com.intellidot.reports.dotgen.Dotgen"><fo:layout-master-set><fo:simple-page-master margin-bottom=".75cm" margin-left=".75cm" margin-right=".75cm" margin-top=".75cm" master-name="normal-page"><fo:region-before display-align="after" extent="10mm" region-name="normal-header"/><fo:region-body margin-bottom="5mm" margin-top="10mm"/><fo:region-after extent="5mm" margin-top="5mm" region-name="normal-footer"/></fo:simple-page-master></fo:layout-master-set><fo:page-sequence master-reference="normal-page"><fo:static-content flow-name="normal-header"><fo:block background-color="#EEEEEE" border-color="black" border-style="solid" border-width=".2mm" color="#000000" font-family="Helvetica" font-size="14pt" font-style="normal" font-weight="bold" text-align="center">Temporary Title</fo:block></fo:static-content><fo:static-content flow-name="normal-footer"><fo:table color="gray" font-size="8pt" table-layout="fixed" text-align="center" width="100%"><fo:table-column column-width="proportional-column-width(1)"/><fo:table-column column-width="proportional-column-width(1)"/><fo:table-column column-width="proportional-column-width(1)"/><fo:table-body><fo:table-row><fo:table-cell><fo:block>Printed By: Phill Tornroth</fo:block></fo:table-cell><fo:table-cell><fo:block>Page <fo:page-number/> of <fo:page-number-citation ref-id="endofdoc"/></fo:block></fo:table-cell><fo:table-cell><fo:block>Printed At: 06/08/2006 13:05</fo:block></fo:table-cell></fo:table-row></fo:table-body></fo:table></fo:static-content><fo:flow flow-name="xsl-region-body">




<fo:block>svg here? 
 <fo:instream-foreign-object>
  <svg height="8.0mm" version="1.1" width="8.0mm" xmlns="http://www.w3.org/2000/svg>
   <g transform="translate(2,2)">
   <g transform="scale(1.0)">
   <g fill="rgb(0,0,0)" stroke="none" transform="translate(-298.55608582680003,489.25566417320005)">
   <path d="M0.658,0.717V0h0.218l0.129,0.489L1.133,0h0.218v0.717H1.216L1.215,0.152L1.073,0.717H0.934L0.793,0.152L0.792,0.717H0.658z"/>
   </g>
   </g>
   </g>
  </svg>
 </fo:instream-foreign-object>
</fo:block>
</fo:flow></fo:page-sequence></fo:root>

[ERROR] Logger not set
[INFO] building formatting object tree
[WARNING] Screen logger not set - Using ConsoleLogger.
[INFO] setting up fonts
[ERROR] Unsupported element encountered: svg (Namespace: default). Source context: unavailable
[ERROR] Expected XSL-FO (root, page-sequence, etc.), SVG (svg, rect, etc.) or elements from another supported language.
[ERROR] Unsupported element encountered: g (Namespace: default). Source context: unavailable
[ERROR] Unsupported element encountered: path (Namespace: default). Source context: unavailable
[INFO] [1]
[ERROR] no handler defined for svg foreign xml
[INFO] Parsing of document complete, stopping renderer


Reply via email to