Re: Clientside filtering and sorting xml with javascript: Work in IE but not Firefox





Alan Searle wrote:


This combination of JavaScript and XML/XSL/HTML (with client-side processing) would be perfect for my needs so what I really like to know is whether there are ways of handling the XML/XSL without dependence on a Microsoft platform?

Mozilla has client-side XSLT support since 1.0 and a frozen API to script XSLT since 1.2 I think, see here for details:
<http://www.mozilla.org/projects/xslt/>
<http://www.mozilla.org/projects/xslt/js-interface.html>
Safari has client-side XSLT support by now I think based on libxml but I am not aware on any API exposed to script.
The Opera 9 preview released some weeks ago has client-side XSLT support based on Opera's own implementation of XSLT but tries to expose the same API Mozilla exposes:
<http://snapshot.opera.com/windows/w90p1.html>
<http://snapshot.opera.com/unix/u90p1.html>


s.loadXML(document.XSLDocument.xml);

Mozilla does not expose XSLDocument if you let the browser do a transformation thus if you want to use XSLT and script in Mozilla it is usually better and easier to start with a HTML document with script that loads XML and style*** as needed and performs the transformation.


The whole IE approach with transforming to a string and inserting that into an HTML document (or even replacing the complete HTML document) is caused by the separate DOM implementations of HTML DOM by MSHTML and XML DOM by MSXML. In Mozilla you can easily transform to a result fragment with DOM nodes which can directly by inserted into the existing document.

However if you want to use client-side XSLT and script then in both IE and Mozilla you face the issue to decide how to combine the rather different APIs and their preferred (DOM result in Mozilla, string result in IE) but incompatible use.

Currently if the aim is client-side sorting and filtering for a web application then XSLT might not be the best option to reach a cross browser compatible solution, you could rather set up appropriate JavaScript data structures/objects and manipulate the HTML DOM only.

--

	Martin Honnen
	http://JavaScript.FAQTs.com/
.


Quantcast