Re: appendChild(newFragment) problem

Axel Hecht <[email protected]>
Newsgroups gmane.comp.mozilla.devel.layout.xslt
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
Michael Vincent van Rantwijk wrote:
> Axel Hecht wrote:
>> Michael Vincent van Rantwijk wrote:
>>> Hi,
>>>
>>> I finally managed to get my source code running, but I have a little 
>>> problem which can be seen in the attached image (that shows the 
>>> duplicated elements).
>>>
>>> I use something like this:
>>>
>>> var targetDocument = gBrowser.contentDocument
>>> var newFragment = processor.transformToFragment(xmldoc, targetDocument);
>>> var _documentElement = targetDocument.documentElement;
>>>
>>> // remove HEAD and BODY elements
>>> while (_documentElement.hasChildNodes()) {
>>>   _documentElement.firstChild.localName);
>>> }
>>>
>>> _documentElement.appendChild(newFragment);
>>>
>>> and that works, except that I end up with two HTML elements, one in 
>>> uppercase, and one in lowercase, so how do I prevent this?
>>>
>>
>> You need to skip the html element in your output fragment as well.
> 
> Another problem is that all elements are in XHTML namespace but the HTML 
> element of the target document not. Should I also set that myself?

Make sure that the output of your XSLT matches your dummy doc in 
doctype. Everything else will go wrong easily.

You shouldn't rely on Quirks mode either.

Using DOM Inspector, I can delete the head element, btw. Not sure what's 
your problem there. You can't remove the document element (HTML), but 
everything else should be fine.

Axel
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.