Accessing XML Document prior to Browser transformation
Alexandre Damiron <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Organization | Guest of ProXad - France |
| Message-ID | <[email protected]> |
Hi, I am sending an xml file with a xsl stylesheet attached. My IE6, or my Firefox 1.0, directly load the xml file (no xmlhttprequest) does the transformation job for me. The result is an xhtml output. Perfect. This output loads a Javascript (present in the stylesheet), and I want this javascript to access the xml content and the xsl content without using an XmlHttpRequest operation, because it seems to me that this is equivalent to a reloading of the file. Yet, I can oonly access the HTML DOM The idea is to manipulate the DOM of that Xml Document, and send the contents to the server, this time using XmlHttpRequest, and at the same time refactoring the output by XsltProcessor. XML content: <?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet href="./stylesheets/gestiondroits.xsl" type="text/xsl" ?> <Repositories><Repository><Path>/home/svn/toto/test</Path><Users/><Trac/><Subversion/><Mails/></Repository><Repository><Path>/home/svn/popfactory/generalProcess</Path><Users/><Trac/><Subversion/><Mails/></Repository><Repository><Path>/home/svn/popfactory/FSA</Path><Users/><Trac/><Subversion/><Mails/></Repository><Repository><Path>/home/svn/systemeu/e.tract</Path><Users/><Trac/><Subversion/><Mails/></Repository><Repository><Path>/home/svn/di/directindustry.com</Path><Users/><Trac/><Subversion/><Mails/></Repository></Repositories> XSL stylesheet <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml"> <xsl:template match="/"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link href="http://demo.popfactory.fr/alexandre/stylesheets/dev.css" rel="stylesheet" type="text/css"/> <script language="Javascript" type="text/javascript" src="./separateOnLoad.js"> </script> </head> <body height="200px" > <div class="devoutputcontent" id="devoutputcontent" > <table> <xsl:for-each select="/Repositories/Repository"> <tr> <td> <div><xsl:value-of select="Path"/></div><input type="button" value="Ajouter un utilisateur" onclick="add_user_input" /> <br/> <table> <xsl:for-each select="Users/User"> <tr> <td> <i><xsl:value-of select="."/></i> </td> </tr> </xsl:for-each> </table> </td> </tr> </xsl:for-each> </table> </div> </body> </html> </xsl:template> <xhtml:script type="text/javascript" /> </xsl:stylesheet> the idea behind separateOnLoad.js var XMLsource = new Object ; var XSLsource = new Object ; XMLsource = document.XmlDocument ; XSLsource = document.XSLDocument ;