Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Need help with passing a parameter [Thread Next] Re: Need help with passing a parameterTo: NULL Date: 10/8/2006 2:09:00 PM Someone wrote: > var processor = new XSLTProcessor(); > var xslt = document.implementation.createDocument("", "", null); > xslt.async = false; > xslt.load("file.xsl"); > processor.importStylesheet(xslt); > var src_doc = document.implementation.createDocument("","", null); > src_doc.async = false; Synchronous loading blocks the browser and should therefore be avoided. > src_doc.load("file.xml"); > processor.setParameter(null,"filter","<?PHP echo $filter ?>"); > var result = processor.transformToDocument(src_doc); So here you already have a DOM document as the result of the transformation but then you first > var xmls = new XMLSerializer(); > var output = xmls.serializeToString(result); serialize it back to a string to then have that string > document.write(output); parsed again into a DOM document. Not a good approach, really inefficient and cumbersome overhead instead. That is why I mentioned transformToFrament which works nicely together with other W3C DOM APIs like appendChild or replaceChild (without the overhead of serializing and parsing back). -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
