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

Proposal to extend (s)XBL definition elements

From: Cyril Concolato <cyril.concolato@enst.fr>
Date: Tue, 21 Sep 2004 15:20:41 +0200
Message-ID: <41502AA9.8040105@enst.fr>
To: www-svg@w3.org

Dear Scalable Vector Graphics Working Group,

After reading the working draft, my first impression is that the 
technologies in sXBL are very much similar to what has been already 
standardized by ISO within the VRML'97 standard [1], and later reused in 
MPEG-4 XMT (BIFS-XML) [2]. These technologies are gathered in the VRML 
notion of PROTO. However, VRML PROTOs have some nice features that I 
would like to propose for consideration into sXBL.

But before going into the details of the proposal, I encourage 
interested readers to go and look at the many tutorials on VRML PROTO 
available on the web since they deal with problems that might pop-up in 
XBL (scopes of id, cascading of events, scopes of scripting ...).

My analysis of sXBL is that the VRML equivalent of the XBL 
'definition'/'template' elements seems to be the construct called 
'PROTO' (see example below). The equivalent of the 'ref' attribute in 
'definition' would be the construct called 'EXTERNPROTO'. This latter 
allows to create external libraries of widgets. Then, the equivalent of 
the 'content' is comprised in the notion of PROTO interface. Coming to 
this latter interface, I would like to propose to extend the 
definition/template elements to match what is currently possible in VRML 
and not in sXBL.

The following - simplified - XMT example demonstrates the new feature.
Here is the PROTO declaration equivalent to the XBL definition. The 
'ProtoDeclare' element declares the binding in terms of VRML construct 
associated with the name of the PROTO:

<ProtoDeclare name="MyHelloWorld">
<field name="myColor" type="Color" vrml97Hint="exposedField" 
colorValue="1 1 1"/>
<IS><connect nodeField="emissiveColor" protoField="Color"/></IS>
<Text string="Hello World from a VRML Proto"/>

The instantiation of a PROTO is made as if the MyHelloWorld element was 
an element built-in the standard as follows:

<ProtoInstance name="MyHelloWorld">
<fieldValue name="myColor" colorValue="1 0 0"/>
<ProtoInstance name="MyHelloWorld">
<fieldValue name="myColor" colorValue="0 1 0"/>
<ProtoInstance name="MyHelloWorld">
<fieldValue name="myColor" colorValue="0 0 1"/>

I agree the XML syntax could be nicer. This is just to give you an idea 
of what is possible in VRML. As you can see, during declaration of the 
PROTO, you declare the interface of this PROTO which is used when 
instantiating the PROTO. The 'ProtoInstance' Element is replaced by the 
content of the 'ProtoDeclare' element (shadow content). But the values 
of the fields in the shadow content are replaced by the values of the 
corresponding fields of the PROTO interface, if given, or by default 
values, defined in the interface.

So what I am proposing is an extension of the behavior of the 'content' 
element. This extension would permit the customization of the binding 
(i.e. of some attributes in the shadow tree) depending on some 
attributes in the bound element. The result in sXBL syntax could be 
something like:

<svg:svg xmlns:svg="http://www.w3.org/2000/svg" version="1.2"
     <xbl:definition element="xblText" attributes="textColor">
       <svg:text fill="@textColor"><xbl:content/></svg:text>

   <xblText textColor="red"> Red text. </xblText>
   <xblText textColor="green"> Green text. </xblText>
   <xblText textColor="blue"> Blue text. </xblText>


Questions and comments are welcome.

Cyril Concolato

[2]The MPEG-4 Book, Fernando Pereira, Touradj Ebrahimi

Cyril Concolato
Dept. Comelec
Ecole Nationale Supérieure des Télécommunications, Paris
46, rue Barrault 75013 Paris
Tel: +33145817991    Fax: +33145804036
Received on Tuesday, 21 September 2004 13:20:43 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:02 UTC