SharePoint.Ajax.XmlTransform

A cross-browser safe Xml Transformer function for simle Xslt transforms.
DOES NOT support Xslt parameters or Xslt includes.

Definition:

///////////////////////////////////////////////////////////////////
// XML TOOLKIT
SharePoint.Ajax.XmlTransform = function (xml, xsl, control){
SharePoint.Ajax.XmlTransformDecode(xml, xsl, control, true);
}
SharePoint.Ajax.XmlTransformDecode = function (xml, xsl, control, decode){
if(decode == null)decode = true;
if (!window.XSLTProcessor){ // ie
var content = xml.transformNode(xsl);
control.innerHTML = content;
}else{ // MOZZILA
var processor = new XSLTProcessor();
processor.importStylesheet(xsl);
var content = processor.transformToFragment(xml, document);
control.innerHTML = '';
if(decode){
var div = document.createElement('div');
div.appendChild(content);
control.innerHTML = SharePoint.Ajax.HtmlDecode(div.innerHTML);
}else{
control.innerHTML = content.innerHTML;
}
}
}

Last edited Dec 26, 2006 at 8:14 PM by daniellarson, version 1

Comments

No comments yet.