Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   xslt: sorting on the client side - cross browser! (http://www.velocityreviews.com/forums/t165785-xslt-sorting-on-the-client-side-cross-browser.html)

Ben Fitzgerald 10-02-2003 10:21 PM

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

Dimitre Novatchev 10-03-2003 08:21 AM

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




Wired Earp 10-03-2003 06:46 PM

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

Dimitre Novatchev 10-03-2003 07:32 PM

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



Wired Earp 10-03-2003 09:27 PM

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

Wired Earp 10-03-2003 09:31 PM

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

Wired Earp 10-03-2003 09:46 PM

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.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57