Re: [xsl] XSL and HTML interaction

Subject: Re: [xsl] XSL and HTML interaction
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Fri, 22 May 2009 18:02:44 +0200
Robert G wrote:
Is there any other way to add to the original html file without using
xsl to create new html and then including that in the original html?
I was looking stuff up online and some sites suggest you can just
"copy and paste" nodes to the original html? Thanks.

It depends on the APIs the browser or its XSLT engine exposes. Mozilla for instance gives you transformToFragment ( and that way you can have the XSLT stylesheet create DOM nodes owned by the target document (e.g. HTML document) which you can then insert using W3C DOM methods like appendChild or insertBefore.
I think Opera and Safari expose the same API by now.

IE uses MSXML for XML and XSLT and that way has two completely separate DOM implementations, the XML DOM of MSXML and the HTML DOM of IE/MSHTML. You can't copy/move/import/adopt nodes between these two DOM implementations so what you do there is have a string result of the transformation (e.g. from transformNode()) and then parse that by setting innerHTML or using insertAdjacentHTML in the HTML DOM.


	Martin Honnen

Current Thread