Subject: Re: RE: [xsl] client-side ajax & xslt|
From: "Robert Koberg" <rob@xxxxxxxxxx>
Date: Fri, 09 Mar 2007 11:35:32 -0500
- the user can then update the display any number of times with a minimum amount of network traffic (the browser cache will cache the data and the xslt).
It will cache the *file* if the user's browser is set to do so. A better approach is to cache the browser specific processor object (created from the file->DOM).
now, i do know that ajax frameworks such as sarissa or even better freja are supposed to support this kind of functionality, but they are poorly documented, under constant development, and seem to routinely break with every minor version of a browser. so i have two questions:
- did anybody have success implementing the above scenario, and if so, which framework did you use and on which browsers did you test it? and would you recommend to do it in the same way you did it?
Yes, with dojo and the XslTransform constructor. I would recommend it (but, I wrote it :) ). There are examples in the $DOJO_HOME/tests/xml directory. It is pretty easy, though:
var myXsl = new dojo.xml.XslTransform("path/to/your.xsl"); myXsl.transformToRegion( xmlSourceDom, paramsArray, htmlElementObject, htmlDocumentObject );
It works in IE, FF and Opera. The exception is Opera in that it does not supprt the document function (yet...). So if you don't need the document function, you should be fine in almost all browsers.
But, a general strategy I use is to have a snmallish config XML for the main source of the transform and bring in larger/more XML files through the document function. This way you don't need to build a real DOM and can rely on the XSL processor's optimized DOM (usually a list of SAXish events).
- in general, is there a chance that something like this runs reasonably stable and works for the majority of users? the static strting table should be good enough for those with older browsers, but i want the more flexible solution to be available to the majority of users.
dojo also has a widget that does this type of table, but with JSON data. It is pretty easy to use too.