Re: SVG - links?

Andrew
 
Thanks for this - yes, it does produce what I want, but misses
what I am trying to achieve.
 
I only want to create *one* <rect> and then be able to move
*and* resize or recolor it as I need; otherwise there is little or
no point in having the <use> element at all, that I can see, and
the SVG agains becomes long-winded and harder to maintain.
 
Can you help with this approach or, failing that point me to
a reasonable description of the role and limits(?) of  the <use>
element?
 
Thanks
Derek

>>> <AndrewWatt2001@aol.com> 06/03/2003 11:32:05 >>>
In a message dated 06/03/2003 08:31:59 GMT Standard Time,
DHohls@csir.co.za writes:



Hi

I am relatively new to SVG - I have done some basic things
to try it out, but need to understand some of the power in its
ability to create 'reusable' graphics.  However, I am unable to
get the xlink in the simple exampe below to work (rather, it does
not display properly when loaded into my IE browser, using the 
Adobe plugin as neither the second or third xlink display the 
rectangles with the width and height specified, although they are
at the correct y-position) - any help  would be  appreciated!

Derek


Derek,

I have modified your code to produce the visual appearance that I guess
you intended.

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="8cm" height="6cm"
xmlns="http://www.w3.org/2000/svg">
<desc>Local URI references within ancestor's 'defs' element.</desc>
<defs>
  <linearGradient id="Gradient01">
   <stop offset="20%" stop-color="#39F" />
   <stop offset="90%" stop-color="#F3F" />
  </linearGradient>
  <rect id="shade1" x="1cm" y="1cm" width="6cm" height="1cm"
fill="url(#Gradient01)" />
  <rect id="shade2" x="1cm" y="1cm" width="2cm" height="1cm"
fill="url(#Gradient01)" />
  <rect id="shade3" x="1cm" y="1cm" width="6cm" height="4cm"
fill="url(#Gradient01)" />
</defs>
<!-- test xlink -->
<use xlink:href="#shade1"/>
<use xlink:href="#shade2" y="1.1cm"  />
<use xlink:href="#shade3" y="2.2cm"  />
<!-- Show outline of canvas using 'rect' element -->
<rect x=".01cm" y=".01cm" width="7.98cm" height="5.98cm"
   fill="none" stroke="blue" stroke-width=".02cm" />
</svg>

The problem with your code wasn't the xlink:href but, I think, your
understanding of the semantics of the <use> element - which are not the
most self-evident.

By the way, if you aren't already aware of it, most "general"
discussion of SVG takes place on the SVG-Developers mailing list on
Yahoo Groups:
http://www.yahoogroups.com/group/SVG-Developers 
or simply email
svg-developers-subscribe@yahoogroups.com 
with "subscribe" in the subject line.

At the present time SVG graphics are not as reusable as the SVG 1.0
specification allows. For example, there is no SVG viewer which will
allow an SVG "visual component" which incorporates animations to be
successfully imported and displayed using the <image> element.
Hopefully, that day won't be too far away now.

I hope that helps.

Andrew Watt 

-- 
This message has been scanned for viruses and dangerous content by 
MailScanner, and is believed to be clean.

"The CSIR exercises no editorial control over E-mail messages and/or
attachments thereto/links referred to therein originating in the
organisation and the views in this message/attachments thereto are
therefore not necessarily those of the CSIR and/or its employees.  
The sender of this e-mail is, moreover, in terms of the CSIR's Conditions
of Service, subject to compliance with the CSIR's internal E-mail and 
Internet Policy."

Received on Thursday, 6 March 2003 04:51:03 UTC