Re: XSLT Conversion not quite there

Martin Honnen <[email protected]>
Newsgroups gmane.comp.mozilla.devel.layout.xslt
Organization Liberty Development
Message-ID <[email protected]>

[email protected] wrote:


> 		var xsltProcessor = new XSLTProcessor();
>         xsltProcessor.importStylesheet(xsldoc);
> 
> 	    var myDocument = xsltProcessor.transformToFragment(xmldoc,
> document);

With transformToFragment you do not get a document but a document 
fragment so that would better be coded as
   var myFragment = xsltProcessor.transformToFragment(xmldoc,
document);
although the variable name is not really relevant.

> 		document.getElementById("dataArea").innerHTML = myDocument;

Use DOM methods to insert the fragment (respectively the child nodes of 
the fragement):
   var dataArea = document.getElementById('dataArea');
   while (dataArea.hasChildNodes()) {
     dataArea.removeChild(dataArea.lastChild);
   }
   dataArea.appendChild(myFragment);


-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.