xslt: sorting on the client side - cross browser!

B

Ben Fitzgerald

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
 
W

Wired Earp

Dimitre said:
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

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.
 
D

Dimitre Novatchev

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
 
W

Wired Earp

Dimitre said:
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.

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/default.asp?url=/library/en-
us/xmlsdk/htm/xml_obj_ixslprocessor_9j8y.asp> - at least if you stick to
the first example on the page.
 
W

Wired Earp

I said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,814
Latest member
SpicetreeDigital

Latest Threads

Top