I'm using JavaScript to apply a xslt transformation to a xml file to return a json object in a specific format.
I'm using the following code to test the process:
var xml = loadDoc("my.xml"); //custom function that loads the xml and xsl docs these are working
var xsl = loadDoc("my.xsl");
var processor = new XSLTProcessor();
processor.importStylesheet(xsl);
var result = processor.transformToDocument(xml);
console.log(result);
I've tested the code with a couple of very simple xml and xsl files with success however the console log outputs a null when I'm testing it with the xsl document and xml I'm supposed to use, they were not prepared by me and I have very little experience with xslt transformations.
I've tested those files using a couple of online tools and they worked on a couple of them but others were unable to perform the transformation. (http://xslttest.appspot.com/ this can run the transformation without a problem but not this one http://www.freeformatter.com/xsl-transformer.html)
version="2.0"? Browsers only support version 1.0. What happens when you try freeformatter.com/xsl-transformer.html, do you get any error message? Can you post the stylesheet code or a link to it?