SVG in SVG with parameter

Discuss SVG code, accessible via the XML Editor.
MMM_
Posts: 2
Joined: Tue Jul 17, 2012 8:33 pm

SVG in SVG with parameter

Postby MMM_ » Tue Jul 17, 2012 8:42 pm

Hi,

I'd like to reference a 2nd SVG File into my file but with giving it a parameter. To do that I found this documentation:

http://www.w3.org/TR/2009/WD-SVGParamPrimer-20090616/

But I can't get any of those 2 solutions working.
The first one with the <Object> Tag doesn't work at all at current Firefox. And Firebug says the <param> Tag shouldn't be used anymore.

The GET-parameter solution isn't working here, too. Either the JavaScript isn't executed or it prints the location of the main file, so the GET-parameter is not visible. But the picture is included right with it.

So, my goal is to set a color of the 2nd file in the main file. Anybody got an idea how to do this or what's wrong with my solutions?

Main file:

Code: Select all

<!-- No Picture -->
 <object type="image/svg+xml" data="a1.svg" x="80" y="80" width="80" height="80">
    <param name="color" value="red" />
 </object>

<!-- Wrong URL -->
<image x="80" y="80" width="80" height="80" cursor="pointer" xlink:href="car.svg" />


2nd File:

Code: Select all

<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<svg width="84" version="1.2" xmlns="http://www.w3.org/2000/svg" height="42" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:atv="http://webmi.atvise.com/2007/svgext">
 <defs/>
 <metadata/>
 <!-- Variable fill color... -->
 <circle fill="#dbdbdb" cx="25.993" cy="33.119" stroke="#000000" r="4.237" id="x" stroke-width="1" />
 
 <script type="text/ecmascript"><![CDATA[
alert(window.location);
]]></script>
</svg>


I'd very thankful for any help.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: SVG in SVG with parameter

Postby ~suv » Tue Jul 17, 2012 11:27 pm

MMM_ wrote:I'd like to reference a 2nd SVG File into my file but with giving it a parameter. To do that I found this documentation:

http://www.w3.org/TR/2009/WD-SVGParamPrimer-20090616/

But I can't get any of those 2 solutions working.

As written on that page you reference, SVG Parameters is only a Working Draft for a module of the future SVG 2.0 specification - there is no existing SVG 1.1 implementation AFAIK which would support them, nor a web browser implementing SVG 2.0 based on the current roadmap for SVG 2.0 (SVG 2.0 has not yet reached the state of a stable W3C recommendation either).

MMM_
Posts: 2
Joined: Tue Jul 17, 2012 8:33 pm

Re: SVG in SVG with parameter

Postby MMM_ » Wed Jul 18, 2012 7:26 pm

Oh ok. You know any workaround or other solutions to this problem?

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: SVG in SVG with parameter

Postby v1nce » Fri Jul 20, 2012 5:21 am

Could you use server-side scripting where image 2 is hosted ?

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: SVG in SVG with parameter

Postby v1nce » Fri Jul 20, 2012 5:26 am

~suv wrote:
MMM_ wrote:I'd like to reference a 2nd SVG File into my file but with giving it a parameter. To do that I found this documentation:

http://www.w3.org/TR/2009/WD-SVGParamPrimer-20090616/

But I can't get any of those 2 solutions working.

As written on that page you reference, SVG Parameters is only a Working Draft for a module of the future SVG 2.0 specification.


May I add it is badly designed ;)


Return to “SVG / XML Code”