Re: Accessing the original XML DOM after browser-applied XSL transformation?
Axel Hecht <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Organization | Another Netscape Collabra Server User |
| Message-ID | <[email protected]> |
blblack wrote: > I'm just now getting ramped up on XML + XSLT stuff with the intent of > possibly using it in a new corporate web app, having come from > previously doing just (X)HTML+CSS, so bear with me. > > The new app's web interface is being designed around the XMLHttpRequest > concept - load the user interface page once when you log in, and then > stay there and dynamically load new content as they click around the > page type of thing. (Yeah I know there's a buzzword for it, but I'm > trying to avoid it :) ). > > In any case, what I'd *really* like to be able to do is: > > 1) Send the initial page as a pure XML document of my own structure, > with an associated static XSL containing a bunch of nested transforms > which transform it into XHTML 1.1 at the browser. > > 2) Have the javascript xmlhttprequest-based interaction code in this > page pull fresh XML data from my server based on the same DTD/namespace > as the original page I sent. > > 3) Use DOM or something similar to insert/append/replace chunks of the > original XML document with the new content. > > 4) The new content should be correctly transformed to XHTML in the > browser just as if it were part of the original document. > > When I got to step 3 is of course where the plan failed. > window.document refers to the resulting XHTML from after the XSL > transformation. "View Source" shows my original XML, but the DOM > Inspector (and as near as I can tell, anything I can see from > javascript-land) only shows the transformed XHTML document. > > Is it just plain impossible? Or am I missing some interface/object > that I failed to find, which would allow me to manipulate the > pre-transform XML? And if there is, will the existing transformation > to XHTML automatically stay in sync with the XML tree changes? > > The only thing I saw that might be close would be to manually load the > xsl a second time from inside javascript and do the transform manually, > but that would also mean that I'd have to manually maintain references > between the XML and HTML trees to know where to map the output to, and > it would screw up XSL transforms that depended on the context of > elements which are not part of the fresh fragment being > loaded/transformed. > Does IE expose the source XML to js in the result doc somehow? If so, is that documented anywhere? Axel