Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - How best to apply XSL to responseXML from XMLHttpRequest?? [Thread Next] Re: How best to apply XSL to responseXML from XMLHttpRequest??To: NULL Date: 1/6/2006 4:31:00 PM j_mckitrick@b... wrote: > I'm making Ajax-type calls that return XML, and rather than parsing the > XML with DOM and building the nodes by hand, it seems much better and > well-designed to get the XML response, get an XSLT stylesheet, apply it > to the XML, and insert the resulting node (containing an HTML table) > into the document at a div. Mozilla does support that approach if you use transformToFragment, see <http://www.mozilla.org/projects/xslt/js-interface.html> Here is an example: <http://home.arcor.de/martin.honnen/operaBugs/op9/XSLT/transformToFragment1.html> Opera 9 preview also implements the API Mozilla has but what I have tested so far while they have the methods like transformToFragment implemented the results might differ from what Mozilla does. But as that is only a preview of Opera 9 I am rather sure they improve that before version 9 will be released. IE with MSXML (3 and later) does not implement anything to produce nodes with XSLT that could be inserted into a HTML document. Rather with MSXML you need to use transformNode to get a string result and then use properties (e.g. innerHTML, outerHTML) or methods (e.g. insertAdjacentHTML) IE exposes to parse HTML snippets into nodes inserted into the HTML document. > But I keep getting javascript errors about not being able to insert the > document at this point in the hierarchy, and also XML parsing errors. You will need to provide more details on your code and on which browser gives exactly which error. Post a URL if you have but do some work yourself to isolate the problems to simple cases you can't solve. -- Martin Honnen http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
