Hello, I have a rather trivial problem that I haven't found a solution yet.
I want to insert dynamically generated SVG code Inside the XML data which is supplied to FOP. To make things simpler, suppose you start from the ExampleObj2PDF found in FOP Embedding page ( https://xmlgraphics.apache.org/fop/2.2/embedding.html#ExampleObj2PDF) and that you add a method in the ProjectTeam entity that generates a SVG String : public String getDynamicSVG() { return " <svg:svg width=\"20\" height=\"20\">\n" + ... + "</svg:svg>"; } ( http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop/examples/embedding/java/embedding/model/ProjectTeam.java?view=markup ) And that this method would be called by the following line inside ProjectTeamXMLReader class handler.element("SVGdynamique", projectMember.getDynamicSVG()); ( http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop/examples/embedding/java/embedding/model/ProjectTeamXMLReader.java?view=markup ) The question is : how to prevent the SVG tags from being escaped into < and >? Below is the XML code I'm getting : ... <svgDynamique> <svg:svg width="20" height="20"> <svg:g style="fill:red; stroke:#000000"> <svg:rect x="0" y="0" width="15" height="15"/> <svg:rect x="5" y="5" width="15" height="15"/> </svg:g> </svg:svg></svgDynamique> ... In the final step, the SVG string would be merged by the projectteam2fo.xsl like this : <fo:block space-before.optimum="15pt"> <fo:instream-foreign-object> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"> <xsl:copy-of select="svgDynamique" /> </svg> </fo:instream-foreign-object>] </fo:block> Is there a way to prevent the escaping? Note that the SVG tags get escaped during the XML processing by SAX not during the insertion into the xsl file. Any help would be greatly appreciated! Pierre Caron
