Re: appendChild(newFragment) problem
Michael Vincent van Rantwijk <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Organization | Another Netscape Collabra Server User |
| Message-ID | <[email protected]> |
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.
Can't I just remove the <HEAD> in the target document?
There's only one child node in my output fragment and that is <head> so
I can't just remove that. Do I really have to insert the nodes one by
one because that's what I will be doing next, right?
Michael