Subject: Re: [xsl] non MS transform From: António Mota <xptm@xxxxxxx> Date: Tue, 21 Dec 2004 17:18:51 +0000 |
With sarissa is as simple as this: var xml = Sarissa.getDomDocument(); xml.async = false xml.load("cdcatalog.xml") // Load XSL var xsl = new Sarissa.getDomDocument(); xsl.async = false xsl.load("cdcatalog.xsl") // Transform var xmlResult = Sarissa.getDomDocument(); xml.transformNodeToObject(xsl, xmlResult); document.getElementById("some-id").appendChild(document.importNode(xmlResult .documentElement, true)); It works with IE, FF and at least two other linux browsers, so they told me... Quoting Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>: > Hi Jeff, > > At 11:26 AM 12/21/2004, you wrote: > >Howdy. I was happy as a clam with > ><html> > ><body>> ><script type="text/javascript"> > >// Load XML > >var xml = new ActiveXObject("Microsoft.XMLDOM") > >xml.async = false > >xml.load("cdcatalog.xml") > > > >// Load XSL > >var xsl = new ActiveXObject("Microsoft.XMLDOM") > >xsl.async = false > >xsl.load("cdcatalog.xsl") > > > >// Transform > >document.write(xml.transformNode(xsl)) > ></script> > > > ></body> > ></html> > > > >But then I was told that I had to come up with a non Microsoft approach. I > >thought that would be easy but my searching has not been successful. > > > >Could someone be so kind as to provide me with a "standard" solution to > >transforming. > > This code is to configure a transformation to run in the client. (IE, on a > Microsoft platform. Hence the potential problem.) > > Since there is actually a variety of web browsers available, and most of > them do not support XML/XSLT at all, a general solution for all browsers > isn't possible. This is a primary reason why many projects opt to transform > on the server, or by pre-processing files in batch mode. In such a case you > get many or most of the advantages of the layered XML architecture, without > the browser dependencies (since they only see HTML). > > In simple cases, you can place an <?xml-stylesheet href="..." ?> PI (google > this) in your XML documents and serve them directly: both IE and > Mozilla-based browsers will recognize the PI and apply a transformation > accordingly. > > If you want something more dynamic but still "standard" on the client, you > could look at sarissa (http://sarissa.sf.net). From their Overview page: > > >Sarissa is a JavaScript meta-API. It bridges the gap of DOM XML extentions > >between Internet Explorer and Mozilla (or Moz-based) browsers. It is an > >effort to provide a common interface for those extentions, bringing them > >closer to eachother. It was originally created to protect my sanity ;-) > > > >Sarissa implements some of the DOM standard and Mozilla extentions for IE > >and some IE extentions for Mozilla. Finally, it provides some factory > >methods, for both browsers. > > Of course, sarissa is not "standard" -- although as an open-source project, > it's non-proprietary. > > Cheers, > Wendell > > > > ====================================================================== > Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx > Mulberry Technologies, Inc. http://www.mulberrytech.com > 17 West Jefferson Street Direct Phone: 301/315-9635 > Suite 207 Phone: 301/315-9631 > Rockville, MD 20850 Fax: 301/315-8285 > ---------------------------------------------------------------------- > Mulberry Technologies: A Consultancy Specializing in SGML and XML > ====================================================================== > > O SAPO ja esta livre de vmrus com a Panda Software, fique vocj tambim! Clique em: http://antivirus.sapo.pt
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] non MS transform, Wendell Piez | Thread | Re: [xsl] non MS transform, M. David Peterson |
RE: [xsl] Cannot view XML input usi, Pieter Reint Siegers | Date | Re: AW: [xsl] Translating roman num, António Mota |
Month |