cliente-side dynamic XSLT transformation with javascript
[email protected] (..tato..)
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
Thinking of trying xml and xsl transformation on the client to present
image collections. Collected some code in the net and, finally, put it
together as shown in the following code snipet.
It is doing what I intended but for 2 bugs, so far...
1st
If I put it inside a simple conditional clause(cross-browser) like
if(MZ){ ... code bellow }
firefox spits it back stating 'error: xslLoad not defined' 8-\
I must be missing something really obvious here!
2nd
removing the clause so it runs, it shows the images on the 2nd frame
but never finishes loading eg. I cannot see the frame´s source and
inspecting the DOM it looks like it is growing recursivelly 8-/
code--------------
xmlDoc = document.implementation.createDocument('', '', null);
xslDoc = document.implementation.createDocument('', '', null);
xmlDoc.addEventListener('load', xslLoad, false);
xmlDoc.load("fcImgList.xml");
function xslLoad()
{ xslDoc.addEventListener('load', xslTransform, false);
xslDoc.load("fcImgList.xsl");
}
function xslTransform()
{ proc = new XSLTProcessor();
proc.importStylesheet(xslDoc);
var xmlObj = proc.transformToDocument(xmlDoc);
var xmls = new XMLSerializer();
var output = xmls.serializeToString(xmlObj);
parent.frmBot.document.write(output);
alert(output);
}
Can someone more experienced point me back to the track?
thx
Renato