Re: Attribute/Property Parameters

Erik,
It is clear that something along the lines of what you are proposing would
be of great utility. In fact, I have proposed features similar to this at
various points during the SVG process for many of the same reasons behind
your proposals.

At this late stage, however, it is unlikely that such a feature will make
it into SVG 1.0, but there is a good possibility that such a feature will
receive strong consideration for SVG 2.0 (or whatever the next version
might be). The 'use' element has turned out to be quite a complex beast
even with its current set of limitations.

One reason that such a feature is unlikely to make it into SVG 1.0 is the
need to coordinate the development of such a feature with the styling
groups (CSS and XSL) and DOM groups at the W3C. The SVG working group's
feeling is that such a feature has utility in areas other than SVG's 'use'
element, and there is a desire to package the feature such that it is
compatible for a wide variety of needs and compatible with some of the work
that is being considered for CSS3 and DOM3. The need to make the feature
general-purpose might have a significant impact on the syntax that we might
choose. For example, we might want to use something akin to CSS selectors
or XPath to identify which sub-elements to the 'use' get overrides, and
maybe CSS selectors might be used to assign override values (for
implementations that support CSS). This will all take lots of thought and
lots of coordination effort with other W3C groups, so there is no way to
guess what the final syntax might turn out to be.

But this feature has so much value, I think it is likely that it will
become part of SVG at some point.

Jon Ferraiolo
SVG Editor
Adobe Systems Incorporated

At 07:12 PM 7/3/00 +0200, Erik.Unger@gmx.at wrote:
>If that topic already has been discussed
>in this list or other news-groups,
>please forgive me, I am new to the SVG-scene.
>In the current SVG version I am missing some thing:
>
>Attribute/Property Parameters
>
>It would be great to have a mechanism,
>which allows you to change some attributes/properties
>of a graphic that is instantiated with the
>use- or image-element, without using scripts.
>This could be achieved with named parameters.
>For every animatable attribute/property an
>def-param element could be defined in the
>same way than animation elements are defined:
>
><!ENTITY % setExt "" >
><!ELEMENT def-param (%descTitle;%setExt;) >
><!ATTLIST def-param
>  %stdAttrs;
>  %testAttrs;
>  externalResourcesRequired %Boolean; #IMPLIED
>  %animTargetAttrs;
>  name CDATA #REQUIRED >
>
>When an graphic is instantiated with use
>or image, a set-param element can be
>used to set a named parameter:
>
><!ENTITY % setExt "" >
><!ELEMENT set-param (%descTitle;%setExt;) >
><!ATTLIST set-param
>  %stdAttrs;
>  %testAttrs;
>  name CDATA #REQUIRED
>  to CDATA #REQUIRED >
>
><!ENTITY % useExt "" >
><!ELEMENT use
>(%descTitle;,(def-param|set-param|animate|set|animateMotion|animateColor|an
imateTransform
>                   %geExt;%useExt;)*) >
><!ATTLIST use
>  ... >
>
><!ENTITY % imageExt "" >
><!ELEMENT image
>(%descTitle;,(def-param|set-param|animate|set|animateMotion|animateColor|an
imateTransform
>                   %geExt;%imageExt;)*) >
><!ATTLIST image
>  ... >
>
>
>Here is an example-dokument, which shows this mechanism:
>
><?xml version="1.0" standalone="no"?>
><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000303 Stylable//EN" 
> 
>"http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd">
><svg width="100" height="50">
>  <desc>Example for using def-param and set-param</desc>
>
>  <defs>
>    <g id="MyGroup">
>      <rect width="100" height="50">
>        <def-param name="rectWidth" attributeName="width" />
>        <def-param name="rectHeight" attributeName="height" />
>      </rect>
>      <circle cx="25" cy="25" r="10" style="fill:red; stroke:blue">
>        <def-param name="circleFill" attributeName="fill" />
>        <def-param name="circleStroke" attributeName="stroke" />
>        <def-param name="circleOffset" attributeName="cx" />
>        <def-param name="circleOffset" attributeName="cy" />
>      </circle>
>    </g>
>  </defs>
>
>  <use xlink:href="#MyGroup">
>    <set-param name="rectWidth" to="75" />
>    <set-param name="rectHeight" to="25" />
>    <set-param name="circleFill" to="yellow" />
>    <set-param name="circleStroke" to="black" />
>    <set-param name="circleOffset" to="20" />
>  </use>
>
></svg>
>
>
>OK, that's the simple version.
>But it would be also useful, to execute
>some basic mathematical calculations 
>before a parameter is applied to an attribute.
>That would enable us to link different graphic-primitives
>to a single parameter, with a free defineable behavior.
>For instance one could place a text always 5 pixel 
>above an complex graphics, whose position/size is
>animated via parameters
>(offcourse the parameters themselve are full animateable).
>The values of other parameters should be available
>for the calculation.
>Then it's possible to use anonymous parameters,
>that calculate their values from other named parameters:
>
>      <rect width="100" height="50">
>        <def-param name="size" attributeName="width" function="size+2"/>
>        <def-param function="size/2" attributeName="height" />
>      </rect>
>
>After all parameters of an use- or image-element are set,
>the functions are calculated and the results are stored in
>the corresponding attributes (not in the 'parameter-variables',
>because that would leed to recursivity).
>
>Defining multiple parameters with the same name,
>is equivalent to defining one named parameter,
>and other, anonymous parameters, whose functions
>use the named paramter without any calculation:
>
>        <def-param name="circleOffset" attributeName="cx" />
>        <def-param name="circleOffset" attributeName="cy" />
>
>is equivalent to:
>
>        <def-param     name="circleOffset" attributeName="cx" />
>        <def-param function="circleOffset" attributeName="cy" />
>
>
>The attributes function and name would be #IMPLIED in the
>DTD above. If none of the two attributes is present,
>the value of attributeName is used for name.
>
>
>What do you think about that ?
>
>-Erik Unger
>(Next-Reality)
>
>
>
>-- 
>Sent through GMX FreeMail - http://www.gmx.net
> 

Received on Monday, 3 July 2000 14:03:29 UTC