XSLT Conversion not quite there
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
Hi,
I have this piece of code that is not quite working. I have tried it
with both transformToDocument and as you can see transformToFragment.
both give me a string output [object DocumentFragment] or in the case
of the Document XMLDocument.
I have tried the serializing code that I have seen in this group (even
though its not good practice) without any luck. Is it obviousd to
anyone what I am missing.
The books.xsl has and output method of HTML.
Any help would be much appreciated.
If this is the wromg group to post to - sorry, just tell me where I
should post.
function handleHttpResponse() {
if (http.readyState == 4) {
if (http.responseText.indexOf('invalid') == -1) {
// Use the XML DOM to unpack the city and state data
xmlDocument = http.responseXML;
var xmldoc = document.implementation.createDocument("", "",
null);
var xsldoc = document.implementation.createDocument("", "",
null);
// These browsers process the code before files are loaded,
// thus need to call DoLoaded function when the files
finishloading
xmldoc.load("books.xml");
xsldoc.load("books.xsl");
var xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xsldoc);
var myDocument = xsltProcessor.transformToFragment(xmldoc,
document);
alert("mydoc load" + myDocument);
//document.close();
//document.write(myDocument.documentElement.innerHTML);
document.getElementById("dataArea").innerHTML = myDocument;
document.close();