Re: Original DOM of a XSLT'd XML

Jonas Sicking <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xml
Message-ID <OsCdnY0uNOWCubHZnZ2dnUVZ_sednZ2d__27477.5878446691$1143743728$gmane$org@mozilla.org>
Rowan Nairn wrote:
> Hi,
> 
> I'm testing for certain types of XML documents when a page loads in the
> xul:browser.  But if an XML document has an XSLT stylesheet associated
> with it (feedburner feeds for instance) then the browser document is
> the DOM for the transform result but not the original XML document.
> How can I get hold of the original?  I'd be happy even if I could get
> it as a string which I could maybe test with a regex and then parse
> with DOMParser if I needed to.

Unfortunatly no. One reason is that we don't want to waste memory 
keeping the original document around when most people don't need it.

What you can do however is simply copy the source document through and 
insert it in your result DOM. Something like this for example

   <html>
     <head> .... other stuff that you currently have
                 in your stylesheet ...
       <div id="source"><xsl:copy-of select="/" /></div>
     </head>
     ... the rest of your stylesheet


You can then access the source document using
document.getElementById('source')

Hope that helps

/ Jonas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.