Re: Dynamically insert SVG graphics in the XML passed to FOP

Pierre Caron <[email protected]>
Newsgroups gmane.text.xml.fop.user
Message-ID <[email protected]>
Thank you Matthias. I was able to generate valid SVG code with this :

        handler.startElement("svgDynamique");
            handler.startElement("http://www.w3.org/2000/svg", "svg", "svg
width=\"20\" height=\"20\"", EMPTY_ATTS);
            handler.startElement("g style=\"fill:red; stroke:#000000\"");
            handler.element("rect x=\"0\" y=\"0\" width=\"15\"
height=\"15\"", "");
            handler.element("rect x=\"5\" y=\"5\" width=\"15\"
height=\"15\"", "");
            handler.endElement("g");
            handler.endElement("http://www.w3.org/2000/svg", "svg", "svg");
        handler.endElement("svgDynamique");

which yielded :

			<svgDynamique>
				<svg width="20" height="20" xmlns="http://www.w3.org/2000/svg">
					<g style="fill:red; stroke:#000000">
						<rect x="0" y="0" width="15" height="15"/>
						<rect x="5" y="5" width="15" height="15"/>
					</g>
				</svg>
			</svgDynamique>

Now, the problem is inserting this code in the fo template.  I have tried
the following :

            <fo:table-cell border-width="0.25mm" border-style="solid">
                <fo:block space-before.optimum="15pt">
                    <fo:instream-foreign-object>
                        <xsl:value-of select="svgDynamique"
disable-output-escaping="yes" />
                    </fo:instream-foreign-object>]
                </fo:block>
            </fo:table-cell>

but I get the following message which suggest that the SVG code isn't
present :

org.apache.fop.fo.ValidationException: "fo:instream-foreign-object" is
missing child elements. Required content model: one (1) non-XSL namespace
child (No context info available)

I have also tried without success either :

 <xsl:copy-of select="svgDynamique"  />

My second question is : if the SVG is generated through Batik, how do you
embed it in the fo file?

Again, thank you very much!



--
View this message in context: http://apache-fop.1065347.n5.nabble.com/Dynamically-insert-SVG-graphics-in-the-XML-passed-to-FOP-tp45237p45239.html
Sent from the FOP - Users mailing list archive at Nabble.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.