![]() |
xslt: sorting on the client side - cross browser!
Hi
I feel I'll be asking for someone to turn water into wine before this happens, but just in case! I'd like to have a page that provides a basic xml document with an xslt that defines the default sorting. Say it's in a table sorted by name with columns age and height. Then, when the user clicks on another column heading, this kicks of a (perhaps javascript) call to change the xslt sort parameter and reformat the page. This would all take place on the client side, and work on mozilla 1.3 and IE5.5 and higher. Is this possible? I realise it's a big ask!! Right now I'm still hoping against hope. Someone put me out of my misery. ;) Thanks, Ben |
Re: sorting on the client side - cross browser!
Pass the name of the sort column and the sort order and the datatype of the
sort field as parameters to the xslt transformation, See for example: http://www.dpawson.co.uk/xsl/sect2/N6461.html#d6859e950 ===== Cheers, Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL "Ben Fitzgerald" <bmf1DELETE@ukonline.co.uk> wrote in message news:slrnbnp96d.mhq.bmf1DELETE@home01.london... > Hi > > I feel I'll be asking for someone to turn water into wine > before this happens, but just in case! > > I'd like to have a page that provides a basic xml document > with an xslt that defines the default sorting. Say it's in > a table sorted by name with columns age and height. > > Then, when the user clicks on another column heading, this > kicks of a (perhaps javascript) call to change the xslt > sort parameter and reformat the page. This would all take > place on the client side, and work on mozilla 1.3 and IE5.5 > and higher. > > Is this possible? I realise it's a big ask!! > > Right now I'm still hoping against hope. > > Someone put me out of my misery. ;) > > Thanks, > > Ben |
Re: sorting on the client side - cross browser!
Dimitre Novatchev wrote:
> Pass the name of the sort column and the sort order and the datatype > of the sort field as parameters to the xslt transformation, > > See for example: > http://www.dpawson.co.uk/xsl/sect2/N6461.html#d6859e950 > > "Ben Fitzgerald" wrote >> ...Then, when the user clicks on another column heading, this >> kicks of a (perhaps javascript) call to change the xslt >> sort parameter and reformat the page. This would all take >> place on the client side, and work on mozilla 1.3 and IE5.5 >> and higher. You'll also need the Mozilla XSLT javascript interface <url:http://www.mozilla.org/projects/xslt/js-interface.html> and the Mozilla DOMParser [for translating XSLT output to DOM elements] url:http://www.xulplanet.com/tutorials/xulqa/q_parsexul.html> For passing params to a clientside XSLT transformation in Explorer you would require installation of the MSXML toolkit extensions, there's an example over at <url:http://msdn.microsoft.com/library/default.asp? url=/library/en-us/xmlsdk/htm/xsl_interactive_9zeb.asp>. No DOMParser available for Explorer, you'll need to update the page using innerHTML. -- Wired Earp Wunderbyte |
Re: sorting on the client side - cross browser!
> For passing params to a clientside XSLT transformation in Explorer you > would require installation of the MSXML toolkit extensions, there's an > example over at <url:http://msdn.microsoft.com/library/default.asp? > url=/library/en-us/xmlsdk/htm/xsl_interactive_9zeb.asp>. This link is to an example of using MSXML in ASP. Passing external parameters to an MSXML transformation is most easily accomplished using the IXSLProcessor.addParameter() method. The place to read about this is the MSXML4 or MSXML3 SDK documentation. ===== Cheers, Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL |
Re: sorting on the client side - cross browser!
Dimitre Novatchev wrote:
> This link is to an example of using MSXML in ASP. Notice the <%@LANGUAGE="JavaScript"%> declaration. The javascript part of the deal is perfectly valid for clientside operations. > Passing external parameters to an MSXML transformation is most easily > accomplished using the IXSLProcessor.addParameter() method. Which is what the example examplifies. > The place to read about this is the MSXML4 or MSXML3 SDK documentation. you are right; there is a better example over at <url:http://msdn.microsoft.com/library/de...l=/library/en- us/xmlsdk/htm/xml_obj_ixslprocessor_9j8y.asp> - at least if you stick to the first example on the page. -- Wired Earp Wunderbyte |
Re: sorting on the client side - cross browser!
I wrote:
> there is a better example over at > <url:http://msdn.microsoft.com/library/de...l=/library/en- > us/xmlsdk/htm/xml_obj_ixslprocessor_9j8y.asp> Except that this example doesn't add params. Sorry about the confusement! -- Wired Earp Wunderbyte |
Re: sorting on the client side - cross browser!
I wrote:
> Sorry about the confusement! Really digging a hole for myself here, but I would like to draw attention away from aforementioned Mozilla DOMParser - you can dump the XSLTProcessors output directly into the DOM structure: var oSchema = document.implementation.createDocument ( "", "", null ); var oOutput = document.implementation.createDocument ( "", "", null ); oTransform.load ( "stylesheet.xsl" ); // when stylesheet is loaded document.documentElement.appendChild ( new XSLTProcessor().transformToFragment ( this.oSchema, this.oOutput ).firstChild ); The wonders of Mozilla. -- Wired Earp Wunderbyte |
| All times are GMT. The time now is 04:27 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.