W3C home > Mailing lists > Public > www-style@w3.org > August 2003

<use> child and SVGElementInstance: example needed

From: Jonathan Chetwynd <j.chetwynd@btinternet.com>
Date: Fri, 15 Aug 2003 07:10:13 +0100
To: www-style@w3.org
Message-Id: <22084E84-CEE7-11D7-AD14-0003939B5AD0@btinternet.com>
How does one reference the child SVGElementInstance object in order to 
setAttribute * ?

found: 
http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGElementInstance
which is wonderfully convoluted text**, if a working example were 
attached it might be easier to rationalise.
what is the usage of keyword correspondingElement? google has 
remarkably little on any of this.

thanks

Jonathan
http://www.peepo.co.uk/test/use-split.svg

**it gets worse, but this is what I would like to understand just now: 
"If the 'use' element references a 'g' which contains two 'rect' 
elements, then the instance tree contains three SVGElementInstance 
objects, a root SVGElementInstance object whose correspondingElement is 
the SVGGElement object for the 'g', and then two child 
SVGElementInstance objects, each of which has its correspondingElement 
that is an SVGRectElement object."


*that is the following code worked fine until I put the graphics in 
<defs> and called them with <use>.
NB <title> has been moved, so nextSibling would not be needed, as it 
were.
Howto change the stroke of the first <path> in music? ASV6 is being 
used, though the solution could be generic.

function onM(event) {
if(event.target.parentNode.firstChild.nextSibling)  
event.target.parentNode.firstChild.nextSibling.setAttribute("stroke", 
"#ddd")
}

<g transform="translate(170, 0)">
<title>music</title>
<a xlink:href="http://www.peepo.com/alfi-x/music.html" 
onmouseover="onM(evt)" onmouseout="outM(evt)">
<use xlink:href="../res/030831.svg#music" />
</a>
</g>

<g id="music" >
<path d="M44 122 44 25 145 3 145 105 a20,12 0 0 1 -55 0 L90 105 a20,12 
0 0 1 55 0 L133 93 133 36 58 54 58 128 a20,12 0 0 1 -55 0 L3 128 a20,12 
0 0 1 55 0" stroke="none" stroke-width="6" fill="none" />
<ellipse cx="30" cy="128" rx="24" ry="14" stroke="none"/>
<ellipse cx="118" cy="105" rx="24" ry="14" stroke="none"/>
<line x1="51" y1="128" x2="51" y2="28" stroke-width="7" />
<line x1="139" y1="105" x2="139" y2="7" stroke-width="7" />
<line x1="51" y1="40" x2="139" y2="19" stroke-width="25" />
</g>
Received on Friday, 15 August 2003 02:06:09 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:23 GMT