Re: problem with Transforming dynamically generated xmll
- From: Martin Honnen <mahotrash@xxxxxxxx>
- Date: Fri, 07 Dec 2007 16:41:26 +0100
reed.emmons@xxxxxxxxx wrote:
I'm trying to load and transform dynamically created xml. It works
great in IE but in Mozilla, it will not transform. I discovered that
when I copy the generated xml into a flat file, it works.
You will need to show a minimal but complete sample of the XML and XSLT demonstrating the problem. Make sure that the server sends the HTTP Content-Type: application/xml header for your XML as otherwise Mozilla does not build an XML DOM document at all.
function loadXMLDoc(fileName)
{
var xmlDoc;
// code for IE
if (window.ActiveXObject){
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
Note that only Msxml2.DOMDocument.3.0 and later (e.g. Msxml2.DOMDocument.4.0, 5.0, 6.0) support XSLT 1.0 while Microsoft.XMLDOM might give you a DOM document that does not support XSLT 1.0.
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation &&
document.implementation.createDocument){
If you want to use XSLTProcessor then why do you check for other unrelated objects? I strongly suggest to check
if (typeof XSLTProcessor != 'undefined')
xsltProcessor=new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml,document);
document.getElementById("inventory").appendChild(resultDocument);
}
I don't see anything wrong with the code that would cause it to fail, as said, show us the XML and XSLT and we can tell you more.
--
Martin Honnen
http://JavaScript.FAQTs.com/
.
- Follow-Ups:
- Re: problem with Transforming dynamically generated xmll
- From: reed . emmons
- Re: problem with Transforming dynamically generated xmll
- Prev by Date: Re: function(){}();
- Next by Date: Re: Release: BASIC compiler and VM in Javascript
- Previous by thread: change javascripts default image directory?
- Next by thread: Re: problem with Transforming dynamically generated xmll
- Index(es):
Relevant Pages
|