Re: problem with empty tag
Martin Honnen <[email protected]> Tue, 18 Sep 2007 17:28:08 +0200
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Organization | Liberty Development |
| Message-ID | <[email protected]> |
mozilla wrote:
> thanks for the quick reply, here is the URL :
> http://dev.afidium.com/testXSLT/
The problem (with Mozilla) is the following use of XMLSerializer:
var html = XSLProcessor.transformToFragment(
XMLDoc, document );
html = ( new XMLSerializer()
).serializeToString( html );
OutputDiv.innerHTML = html ;
Simple replace that with
while (OutputDiv.hasChildNodes())
{
OutputDiv.RemoveChild(OutputDiv.lastChild);
}
OutputDiv.appendChild(XSLProcessor.transformToFragment(XMLDoc,document));
that way it should work and is much more efficient as
transformToFragment already gives you HTML DOM nodes that can simply be
inserted.
Your current code creates HTML DOM nodes, then serializes them according
to XML rules with XMLSerializer to then parse the result according to
HTML rules again. All unncessary and prone to errors as XML
serialization and HTML parsing do not follow the same rules.
--
Martin Honnen
http://JavaScript.FAQTs.com/