Re: How to get XSLTProcessor.transformToDocument output in a tab/document?
Michael Vincent van Rantwijk <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Organization | Another Netscape Collabra Server User |
| Message-ID | <[email protected]> |
Michael Vincent van Rantwijk wrote:
> Hi,
>
> How do I display a XSL Transformed XMLDocument(fragment) after
> reading it in with XMLHttpRequest.open("GET", aURL) ???
>
> Something like this works when I first load the XML uri into a tab:
>
> var ownerDocument = document.implementation.createDocument("", "", null);
> var newFragment = processor.transformToFragment(doc, ownerDocument);
> var _documentElement = doc.documentElement;
>
> while (_documentElement.hasChildNodes())
> _documentElement.removeChild(_documentElement.firstChild);
> _documentElement.appendChild(newFragment);
>
> But I don't want to load it into a tab.
> I just want to load it, transform it and put the output into a tab.
> I use this:
>
> var newDocument =
> processor.transformToDocument(XMLHttpRequest.responseXML);
>
> instead of method transformToFragment (I hope that's the right thing use)
> without any warnings and errors, so it seems to be fine but...there's no
> output. Or when I change it a little, the complete window is overwritten
> replaced with the backgkround of my XSL stylesheet and a text for empty
> sidebar is displayed, so I must be doing something very wrong.
>
> Again, everything works when I call my function *after* entering the URL
> into
> the locationbar, but that's not what I want!
>
> Uhg, I hope I made myself clear.
> I whish my English was a little better--maybe next year ;)
>
> TIA
> Michael
I now get a transformed XML document in getBrowser().contentDocument
Ok, the images don't look right yet (will have to find out why) and I
have duplicated entries at the top of the document for HTML/HEAD/TITLE
and BODY (which I assume should be remove before I add the new fragment)
but at least I made some progress ;)
Michael