Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: How best to apply XSL to responseXML from XMLHttpRequest??

From: Martin Honnen <mahotrash@-----.-->
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/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent