How to dynamically insert HTML from XSLT into document?
"Siegfried Heintze" <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Organization | Another Netscape Collabra Server User |
| Message-ID | <[email protected]> |
Here is a fragment of my code that is working:
processor.importStylesheet(xslNode);
var xmlNode = (new DOMParser()).parseFromString(
'<?xml version="1.0"?>'
+'<document>'
+'<x name="x">x</x>'
+'<y name="y">y</y>'
+'<z name="z">z</z>'
+'<abc>'
+'<def>def</def>'
+'</abc>'
+'</document>', "text/xml");
var newDocument = processor.transformToDocument(xmlNode);
xslTarget.innerHTML = (new
XMLSerializer()).serializeToString(newDocument);
This seems terribly inefficient to take the DOM resulting from the XSLT and
convert it to a string only to parse it again when it is stuffed into the
innerHTML. Is there a simpler way? Perhaps I could just add "newDocument" as
a child of xslTarget? Does anyone have an example of better way of
displaying the result of a XSLT?
Also, is there a better way to load xml (than what I have done above) since
Martin Honnen is discouraging me from using XML data islands? I suppose I
could load an XML file from the server. Are there any other alternatives to
data islands?
Thanks,
Siegfried