Re: [xsl] partial load of xml documents

Subject: Re: [xsl] partial load of xml documents
From: Emmanouil Batsis <Emmanouil.Batsis@xxxxxxxxxxx>
Date: Tue, 26 Jul 2005 18:34:25 +0300
Supposing you have an id for each node, when it is clicked all you have to do is check whether its child nodes have been loaded and if not, load them (one level at a time). You can easily pass the node ID to your server app (with an XMLHttpRequest object or using an XML documents .load method) which should return the first level children of the node.

Now, if your structure is something like

<div>
   <ul>
<li id="n1" onclick="loadChildren(this)">bla</li>
</div>

then, with Sarissa[1], that would be as easy as

function loadChildren(oElem){
if(oElem.getElementsByTagName("*").length = 0){
Sarissa.updateContentFromURI("/childNodes/load.do?id="+oElem.id, oElem, transformer);
};
};


Where transformer is an XSLTProcessor object. You can easily tell your server app to transform for you if a client side XSLT does not apply.

[1] http://sarissa.sourceforge.net

hth,

Manos


crvelin@xxxxxx wrote:


I'm working on examples of expandable/collapsible tree's. At some examples
the amount of nested branches is very huge. The results are large xml
documents which are taking a while for transformation (since i'm doing it
clientsided).


Further, for expanding one single branch, the whole xml document must be
reloaded --> "xmlDoc.documentElement.transformNode(xslDoc)". To get an
alternative approach (if there is one), i am wondering if there is a
possibility to load only specific parts of an xml document or to point the
xsl transformation to a certain branch for re-rendering it.

I've already done some first steps in this direction. Initially i'm loading only the top nodelevel, which enormously reduces the loading time. By expanding one node,i'm loading the correpsonding branch. I'm realising this by changing some attributes which defines expanded and collapsed
states.
Then i have defined severals templates which are covering those given
states.
But this approach leads me to the same point. Means, with each node which
will be expanded, the loading time increases again. At this point i should be
able to
verify if one branch's already loaded or not. Is this possible?



I would appreciate any tiny hint and thank in advance for help.


-Used processor(Vendor: Microsoft, Vendor URL: http://www.microsoft.com)


Best regards, Crvelin

Current Thread