Altova Mailing List Archives>Archive Index >xsl-list Archive Home >Recent entries >Thread Prev - [xsl] XSLT interacting with Javascript [Thread Next] Re: [xsl] XSLT interacting with JavascriptTo: xsl-list@-----.------------.--- Date: 6/2/2009 5:28:00 PM Robert G wrote: > var xsltProcessor=new XSLTProcessor(); > xsltProcessor.importStylesheet(xsl); > xsltProcessor.setParameter(null,"type","html"); > xsltProcessor.setParameter(null,"type2","java"); > > var result= xsltProcessor.transformToDocument(xml); > var serial= new XMLSerializer(); > var out= serial.serializeToString(result.documentElement); > var output= document.getElementById("example"); > output.innerHTML=out; Well Mozilla nicely allows you to produce HTML DOM nodes with an XSLT transformation that you can appendChild directly into your HTML document, simply by using var fragment = transformToFragment(xml, document); // might want/need to remove contents of output first output.appendChild(fragment); so use that instead of creating a result document first, then serializing that (as XML) with XMLSerializer, then parsing that (as HTML) by setting innerHTML. -- Martin Honnen http://msmvps.com/blogs/martin_honnen/ --~------------------------------------------------------------------ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/ or e-mail: <mailto:xsl-list-unsubscribe@l...> --~-- | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
