W3C home > Mailing lists > Public > www-svg@w3.org > February 2003

return value of a function as attribute value?

From: Felix Breuer <felix@fbreuer.de>
Date: 16 Feb 2003 11:02:50 +0100
To: www-svg@w3.org
Message-Id: <1045389770.1482.4.camel@tapir>

Hello!

I want to have the position of an svg element calculated by the
rendering application. E.g. consider the following document

<svg id="svg-root" width="100%" height="100%" viewBox="0 0 80 60">
   <g transform="translate(10,30)">
     <text x="0" y="0">one</text>
     <text x="number(../text[1]/@textLength())" y="0">two</text>
   </g>
</svg>

Now my questions are:

A) Is the above document a legal SVG document? I.e. does SVG 1.1 allow
functions (which are defined by XPath) to be evaluated to yield the
actual value of an attribute or do all attribute values have to be given
as explicit, literal numbers?

B) If this is not a legal document, is there some way to accomplish what
I want? I.e. is there some way to determine the length of one text
element and have the position of another text element depend on it?

All documentation on "scripting" I could find was connected with
animation or event-handling. Note, that I am trying to do neither here.

Thanks for any advice,
Felix Breuer

-- 
Felix Breuer <felix@fbreuer.de>
Received on Sunday, 16 February 2003 05:03:54 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:24 GMT