function loadDocument(fileName) 
{

		var xmldoc
		
		if(window.XMLHttpRequest){
			xmldoc = new window.XMLHttpRequest();
			
			xmldoc.open("GET",fileName,false)
			xmldoc.send("")
			return xmldoc.responseXML;
		}
		else if(window.ActiveXObject){
			xmldoc = new ActiveXObject("Microsoft.XMLDOM");
			xmldoc.async = false;
			xmldoc.load(fileName)
			return xmldoc
		} else{
			alert("XML loading not supported.");
			return null;
		}

	/*  
	 *	a seconda che il borwser sia IE o Firefox, si crea un oggetto
	 *  MSXML2.DOMDocument oppure un Document object nativo per Firefox. 
	*/

	/*

	var xmlDoc = window.ActiveXObject ? new ActiveXObject("MSXML2.DOMDocument.3.0") : document.implementation.createDocument("","",null);
	xmlDoc.async = false;
	xmlDoc.load(fileName);

	return xmlDoc;

	*/

}

function getTransformedHTML(xmlDoc, xslDoc) 
{

	var html = "";
	
	/* Implementazione per Firefox */
	if (window.XSLTProcessor)
	{
	     var xsltProc = new XSLTProcessor(); // creazione di un'istanza del processore XSLT
	     try {
	     	xsltProc.importStylesheet(xslDoc);  // importazione del foglio di stile
	     }
	     catch(err) {
	     }	
	     var fragment = xsltProc.transformToFragment(xmlDoc, document);
	     html = new XMLSerializer().serializeToString(fragment); // serializzazione del codice  HTML in una stringa prima di aggiugnerla alla pagina
	}
	else if (window.ActiveXObject) /* Implementazione IE */
	{
	     html = xmlDoc.transformNode(xslDoc);
	}

	return html;
	
}


