Hi Urs,
Please take the time to read the FAQ:
http://xml.apache.org/batik/faqs.html#faq-23
Urs Hensler wrote:
Hi,
I don't speak english very well. So, I hope you understand my question.
I modified the sample file "test/spec/scripting/nestedsvg.svg" (see below). The nested svg-elemet is now created on the fly in the ecmascript. In the original file the svg-element was part of the <defs> section.
When I load the file in Batik the rect is NOT displayed. In the Adobe SVG Plugin it IS displayed. Is this a bug? Or is my ecmascript not correct?
Thank you in advance, Urs
<?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="body" width="450" height="500" viewBox="0 0 450 500">
<title>nested svg element</title>
<script type="text/ecmascript"><![CDATA[ function build(evt) { var g = evt.target; //var svg = g.ownerDocument.getElementById('svg'); var svg = g.ownerDocument.createElementNS(null, 'svg'); svg.setAttributeNS(null, 'id', 'svg_test'); svg.setAttributeNS(null, 'width', '450'); svg.setAttributeNS(null, 'height', '500'); svg.setAttributeNS(null, 'viewBox', '0 0 450 500'); var rect = g.ownerDocument.createElementNS(null, 'rect'); rect.setAttributeNS(null, 'id', 'rect_test'); rect.setAttributeNS(null, 'x', '10%'); rect.setAttributeNS(null, 'y', '10%'); rect.setAttributeNS(null, 'width', '80%'); rect.setAttributeNS(null, 'height', '80%'); rect.setAttributeNS(null, 'style', 'fill:crimson'); svg.appendChild(rect); g.appendChild(svg); }
]]></script>
<g> <g onload="build(evt)" id="test-content"> </g> </g>
</svg>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
