Xhtml2dom.js.xsl

After thinking quite intensely about what I wrote about Cappuccino and how it reminded me of an XSL template I wrote awhile back which basically converted XHTML documents into DOM generating javascript code.

What's the point of that? Its nice because its really allows the ability to implement client-side templates. This is certainly possible through a myriad of other techniques, but what I like so much about this is that it is straight javascript code, resulting in basic DOM implementations.

The other techniques I speak of are:

  • Javascript template with JSON data structures
  • JSONP (wraps JSON in a dynamic function call as an argument)
  • Basic AJAX - as long as the source domain is the same as the destination (same-domain rules)

How is this similar and/or different than Cappuccino?

Cappuccino applications are written in Objective-J, which is preprocessed (almost compiled) into javascript code. Objective-J provides access to a robust user-interface API, based on cocoa.

Xhtml2dom.js.xsl has no user-interface API, but browsers have a native version, and I'm totally committed to open standards. Originally I felt it would be helpful because the converted dom components could be cached, but that's less significant when it comes to rich application development when pages aren't reloaded every review.

Thinking more about this, I realize that there is a lot more that needs to be done for Xhtml2dom.js.xsl to be really useful. For instance, it could be used to create DOM object prototypes based upon XHTML which can be cloned and customized based upon a JSON object.

Certainly something to think about....

Almost forgot - a link to the stylesheet that converts XHTML to DOM javascript!


By Albert on May 19, 2010 9:40 PM

Categories: