[whatwg] about rich internat applications

Didier PH Martin martind at netfolder.com
Tue Jun 8 10:06:22 PDT 2004

Hi Dean,

> dhtml behaviors and xbl aren't a million miles apart. basically they
> define extensions to existing elements. they also contain a bunch of
> code to implement these extensions. the only thing that is different is
> the markup. i've successfully ported microsoft dhtml behaviors to
> mozilla without conversion:
> http://dean.edwards.name/moz-behaviors/

Thanks a lot Dean, I will take a look at the behavior implementation I
didn't know somebody did it.

> it is possible to do the reverse. it would be possible to define any
> components required by web forms in xbl. then transform them (possibly
> xslt) to dhtml behaviors. it would require a certain amount of
> discipline on behalf of the developer but the benefits are huge. one
> code set to maintain. another advantage is that the *actual* source code
> exists in xbl (an open source technology). this is probably easier said
> than done but it is definitely very doable.

I started to write a very basic xform processor in XSLT and ended up instead
to encode the binding in the end HTML element (That I consider for rich
internet apps as a visual object). Here is the XSLT construct I am using to
include the binding to the XML element. As you know, both in Moz and IE,
there are three simultaneous DOMS: XSLT, XML and HTML. The binding attribute
help me find the XML element mapped into the visual object. For instance, I
am using Xlink extended elements to create collection of links. Then in the
mapped HTML element (i.e. a DIV) I include a bind attribute to map it to the
model incarnated by the XML element. The bind attribute includes the Xpath
location of the XML element. For example, the following DIV is linked to its
model counterpart.

<div bind="pdml/object[3]">

So when my stylesheet is creating the DIV element, I include an extra
attribute named bind into the DIV element. Do a call-template to create the
XPATH value to be associated to the bind attribute. 

Bottom line, I discovered that this mechanism is much more extensible and
adaptable than Xform and can be adapted to any XML domain language.

Here is the template I use to create the Xpath bind.

<xsl:template name="generateXPath">
    <xsl:for-each select="ancestor::*">/<xsl:value-of select="name()"/>
      <xsl:variable name="number"><xsl:number/></xsl:variable>
      <xsl:if test="current() != /">[<xsl:value-of select="$number -
    <xsl:variable name="number"><xsl:number/></xsl:variable>
    <xsl:value-of select="name()"/>[<xsl:value-of select="$number -

Didier PH Martin

More information about the whatwg mailing list