[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] How to load xsl and xml using js in netscape?


Subject: [xsl] How to load xsl and xml using js in netscape?
From: "Liew Yean Lieng" <yean@xxxxxxxxxxxxxxxx>
Date: Thu, 3 Mar 2005 16:56:29 +0800

Hello everyone,

Sorry if this question seems basic, but I have to implement xml xsl
 to support Netscape site visitors. I've been plugging away at this for
hours reading up on client-side XSL Transformations versus server-side XSL
Transformations. One article provided me with a JavaScript that it says
works in IE 6+ and NS 6+/Mozilla 1.2+ at
http://www.ebargoon.ca/sell/ebhtml.asp but it didn't work for me on
Netscape.  I even upgraded to Netscape 7.1 just to triple-check  but no such
luck. I've been reading up on "JavaScript/XSLT Bindings" at
http://devedge.netscape.com/viewsource/2003/xslt-js/ and did a
hack-and-paste job of using the bits of JavaScript they provide, but no luck
on Netscape. My servers don't support ASP so what can I do?  There was a
somewhat related thread posted in 1999 at
http://www.biglist.com/lists/xsl-list/archives/199910/msg00626.html with two
opposing viewpoints, and I'm hoping that in 2003, there's a copy-and-paste
solution for me either in JavaScript, or even PHP.  Again, sorry if you
think this post is off topic but it's the foundation of getting XSL
Transformed to XHTML and I could really use some help here.

Thanks kindly!


1. Client Side XSL:
   Pros: JavaScript doesn't rely on type of server
   Cons: Doesn't work in Netscape

<script type="text/javascript">

// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("library.xml")

// Load XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("library.xsl")

// Transform
document.write(xml.transformNode(xsl))

</script>

2. ASP Server Side XSL:
   Pros: Works in latest IE and Netscape
   Cons: APS Servers Only

<%
'Load XML
set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = false
xml.load(Server.MapPath("library.xml"))

'Load XSL
set xsl = Server.CreateObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load(Server.MapPath("library.xsl"))

'Transform file
Response.Write(xml.transformNode(xsl))
%>


Current Thread
Keywords