Menu

#6 transformToFragment

open
nobody
None
5
2006-06-06
2006-06-06
No

This works for me in Internet Explorer:

XSLTProcessor.prototype.transformToFragment = function
(sourceDoc, ownerDoc) {
this.processor.input = sourceDoc;
this.processor.transform();
var s = this.processor.output;
var f = ownerDoc.createDocumentFragment();
if (this.outputMethod == 'text') {
f.appendChild(ownerDoc.createTextNode(s));
} else if (ownerDoc.body &&
ownerDoc.body.innerHTML) {
var container = ownerDoc.createElement('div');
container.innerHTML = s;
var returnValue
=container.firstChild.cloneNode(true);
return(returnValue);
}
else {
var oDoc = new
ActiveXObject(_SARISSA_DOM_PROGID);
if (s.substring(0, 5) == '<?xml') {
s = s.substring(s.indexOf('?>') + 2);
}
var xml = ''.concat('<my>', s, '</my>');
oDoc.loadXML(xml);
var container = oDoc.documentElement;
while (container.hasChildNodes()) {
f.appendChild(container.firstChild);
}
ownerDoc.removeChild(container);
}
return f;
};

Discussion


Log in to post a comment.