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

Re: Newbie question: Mathematical functions?

From: Cameron McCormack <cam-www-svg@aka.mcc.id.au>
Date: Wed, 4 Feb 2004 22:26:36 +1100
To: www-svg@w3.org
Message-ID: <20040204112636.GA9176@mcc.id.au>

Robin Berjon:
> This is interesting. Is there any reason you didn't use XPath to encode 
> the expressions?

I did use XPath syntax, but in the prototype available on the web site
at the moment I used functions to get the attributes, as I hadn't found
an easy way to get expressions like id('r')/@width to get the current
value of the width constraint, and not just the string value of the
width attribute.

In my next iteration of the CSVG extensions I have managed to do this,
however, and the syntax is much nicer.  Constrained attributes are
declared like this:

  <rect id="r" x="50" .../>
  <rect x="0" y="0" width="100" height="100">
    <c:constraint attributeName="x" value="id('r')/@x"/>
  </rect>

The second rect has a default x value of 0, and if the browser
understands the constraint extensions, its x value will track the x
value of the rect with id 'r'.  I've tried to make this new syntax
parallel the way animation works so that it could be more easily
integrated into Batik.

I will be updating the web site in the next couple of weeks with the
next version of the browser and the new syntax and typing features.

Cameron

-- 
Cameron McCormack
|  Web: http://mcc.id.au/
|  ICQ: 26955922
Received on Wednesday, 4 February 2004 06:26:56 GMT

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