Re: XBL is (mostly) W3C redundant, and CSS is wrong W3C layer for semantic behavior *markup*

On Mon, 30 Dec 2002, Shelby Moore wrote:
> At 05:50 PM 12/30/2002 +0000, Ian Hicksonwrote:
>>> From private discussion, I generated the following XSLT snippet which is
>>> concise example of XSLT's powerful capabilities to make general transforms
>>> from abstract markup to any desired implementation.  This translates a
>>> <select> into radio buttons.
>>
>> No offense but that _completely_ misses the point.
> 
> Which point is that exactly?

The challenge was to use XSLT to take a combination of elements in a
source document and provide the user with dynamic behaviour such as
typically expected of a <select> element.

What you did is use a document-wide transformation to convert one
element into another, without providing any dynamic behaviour,
styling, DOM-level functionality, form submission support, or session
history support.

The point was that XBL allows this to be done easily while XSLT does
not.


>> Here you have a document fragment:
>>
>>   <foo size="1">
>>    <bar> baz </bar>
>>    <bar> quux </bar>
>>   </foo>
>>
>> Make it so that when that document fragment appears in a graphical
>> Web browser, it renders as a horizontal box with the width "quux",
>> the height of one line, so that when you click on it you get a drop
>> down box with the two items on it, so that when you hover over an
>> item you get a hover effect, so that when you click on an item the
>> value of the box changes and so that form submission and session
>> history take this value into account.
> 
> You have done a good job in presenting a complex enough example,
> that I do not have time to implement it right this minute.

Very well, let me present you with a much simpler one.

Given a document:

   <?xml-stylesheet href="example" ?>
   <root/>

...give me the XSLT stylesheet "example" which would cause any
children added to this element using DOM access to be given a child
text node with the text "Child", followed by the value of the
element's "number" attribute, followed by the text ": ", and a DOM
method that, when invoked, appends the text passed as the argument to
this text.

Fair's fair, so I wrote the CSS+XBL equivalent:

   CSS: http://www.hixie.ch/tests/adhoc/xbl/demos/simple-stylesheet.css
   XBL: http://www.hixie.ch/tests/adhoc/xbl/demos/simple-xbl.xml

I made a test driver app in HTML to test it:

   HTML: http://www.hixie.ch/tests/adhoc/xbl/demos/simple-driver.html

For completeness, here is also the link to the two line XML file
quoted above:

   XML: http://www.hixie.ch/tests/adhoc/xbl/demos/simple-document.xml

I know this is a very simple example, since I wrote it completely
within the time it took me to write this e-mail.

Could you show me the XSLT which would replace the CSS and XBL given
above to get the same effect without changing the HTML file? (There is
_absolutely nothing_ XBL-specific in the HTML file.)


>>> Remember that XSLT is Turning complete [...]
>>
>> So is the brainfuck programming language [1], but that doesn't tell you
>> ANYTHING about how useful the language is.
> 
> Being obscene is certainly dramatic, but it doesn't prove any thing
> regarding whether the Turing complete capabilities can perform
> complex examples such as the one you present above.

My apologies, it was certainly not my intent to offend or be obscene.
Brainfuck is the name of the programming language, there isn't much I
can do about that.

My point stands, though: that a language is turing complete does not
imply anything about its abilities in terms of the surrounding
environment.

A better example than brainfuck is a Turing Machine. A Turing Machine
is Turing Complete, but it has no way to play music on a sound card,
since the Turing Machine specification doesn't include an API for a
sound device of any kind.


>> Turing complete does _not_ mean it can do anything -- XSLT cannot, for
>> instance, add a new DOM interface to an element.
> 
> Of course it can.

How?

A thorough examination of the XSLT spec uncovered only two occurances
of the term DOM, and neither had anything to do with extending the DOM
to add custom methods or properties.

Did I miss something?


> Making extensions to DOM to accomplish binding is silly
> non-orthogonal design.

Non-orthogonal to what?

Behaviour bindings are, by their very nature, a combination of styling
and dynamic DOM manipulation.


>>   2. The times next to the posts on http://ln.hixie.ch/ are, in the
>>      markup, served as times in UTC. Using XBL [3], the times are
>>      displayed in the local time zone.
>>
>>      Can you do this is XSLT at all?
> 
> 
> Of course this is very easy.  You would just enclose the time content in
> custom tag of name yuo choose such as <timezone>2002-12-27 23:21 UTC</timezone>

Without changing my originial markup [1], how would you do it?

I would be very interested in seeing the actual XSLT you would use to
do this. My thorough examination of the XSLT spec did not find any
date or time manipulation routines.


> And then your page would run on ALL browsers. I can't believe that
> you would make your web page only run properly on Mozilla with it's
> miniscule usage. I guess you only expect visitors from your Mozilla
> friends. It is a small world after all.

The binding is not essential to the page -- which is why it is bound
from the CSS level.


>> XSLT, XBL and XUL are three, IMHO, totally orthogonal languages.
> 
> Agreed as set.
> 
> But XBL is not orthogonal to DOM and CSS as explained in previous posts.

Indeed. XBL is a glue language to combine DOM and CSS together for
behavioural styling.

It is not the only language developed for this purpose -- Microsoft
developed HTCs several years ago; Netscape developed ActionSheets
(although those were never implemented).

XBL and HTCs are actually very similar at a superficial level,
although IMHO XBL integrates the W3C technologies in a better fashion.
(It was invented after HTCs, and learnt a great deal from the
experience the Web had with HTCs.)


>> Behaviours are not semantic --
>  
> EXACTLY!  That is why you don't want to merge binding and behaviors. 

What do you think is the difference between bindings and behaviours?


> You are not locked into a non-orthogonal merged mix.

I haven't the first idea of what you mean by this.


> You are thinking non-orthogonally. 

Why thank you. I do believe that is one of the nicest compliments I've
been given recently.

-- References --
[1] http://ln.hixie.ch/

-- 
Ian Hickson                                      )\._.,--....,'``.    fL
"meow"                                          /,   _.. \   _\  ;`._ ,.
http://index.hixie.ch/                         `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 31 December 2002 01:28:42 UTC