Re: How to dynamically insert HTML from XSLT into document?
R_O_O_K <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Organization | Aster City Cable |
| Message-ID | <[email protected]> |
Hi! It would be sth like var df = processor.transformToFragment(xmlNode, document); xslTarget.appendchild(df); Best regards! Michal Ziemski Dnia 2005-02-01 07:51, Użytkownik Siegfried Heintze napisał: > 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 > >