The output from the transformToFragment() method inserts a leading whitespace node (nodeType=3) at the beginning of the returned fragment. Ex: // obtain an XML doc var inputXml = '<somexml />'; // setup a receiving node var container = document.createElement('div'); // do the transform var transformedFragment = XSLTProcessor.transformToFragment(inputXml, document); // insert the fragment into the DOM container.appendChild(transformedFragment); // verify that XML has no leading whitespace node var x = (inputXml.firstChild.nodeType == 1) // returns true // check the inserted fragment var y = (container.firstChild.nodeType == 1) // returns false The nodeType of container.firstChild is 3 (a whitespace). The expected behavior (as is from Firefox and IE) is not to have an extra whitespace node.
Created attachment 15348 [details] test case (works correctly) I have tried to create a test case from this bug description, but couldn't - transformToFragment worked correctly for me. Obviously, this may depend on the stylesheet used. Could you please attach a complete test case?
No reply to a request for additional information in three months; closing.