Working:
xmldoc.load("c:\\source.xml");
xsldoc.load("c:\\source.xsl");
document.write(xmldoc.transformNode(xsldoc));
Not Working:
xmldoc.load(string with contents of source.xml);
xsldoc.load(string with contents of source.xsl);
document.write(xmldoc.transformNode(xsldoc));
> Not Working:
> xmldoc.load(string with contents of source.xml);
Well the method expects a URL or file name, not the XML markup. Use
loadXML in that case
if (xmldoc.loadXML(stringWithXmlMarkup))
{
// loaded successfully
}
else
{
// handle xmldoc.parseError.reason here
}
loadXML is specific to Microsoft's MSXML, I assume you are using that.
For JavaScript inside Mozilla you would use
var xmldoc = new DOMParser().parseFromString(stringWithXmlMarkup,
'application/xml');
--
Martin Honnen --- MVP XML
http://msmvps.com/blogs/martin_honnen/