xul generation with xslt
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
Hi,
I am trying to generate xul with an xsl stylesheet in javascript. I
have tried many different things, but none seem to work. Here is the
simple stylesheet.
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
version="1.0">
<xsl:output method="xml" media-type="application/vnd.mozilla.xul+xml"/>
<xsl:template match="/">
<window title="example">
</window>
</xsl:template>
</xsl:stylesheet>
And here is the javascript part:
var xsldoc = document.implementation.createDocument("", "", null);
xsldoc.async = false;
xsldoc.load("test.xsl");
var xmlLoad = new DOMParser().parseFromString("<?xml
version=\"1.0\"?>", "text/xml");
xslt.importStylesheet(xsldoc);
var result = xslt.transformToDocument(xmlLoad);
alert(result.documentElement.innerHTML); // result...innerHTML is
undefined
The problem is that result.documentElement.innerHTML doesn't seem to be
valid... it's undefined. Using a stylesheet that creates an html
document (non xul), result.documentElement.innerHTML contains the
expected result.
Interestingly enough, result.documentElement.firstChild.tagName is
HEAD. Any ideas?
-Willy