Hibaüzenet

Deprecated function: Function create_function() is deprecated GeSHi->_optimize_regexp_list_tokens_to_string() függvényben (/web/htdocs/www.infokristaly.hu/home/www/sites/all/libraries/geshi/geshi.php 4698 sor).

XSLT kliens oldalon

Apró programocska egy JavaScript XSLT-hez Firefoxra.

xsltProcessor = new XSLTProcessor();
 
function init(){
  xsltProcessor.reset();
  var myXMLHTTPRequest = new XMLHttpRequest();
  myXMLHTTPRequest.open("GET", "fields.xsl", false); //syncronous call with last param false
  myXMLHTTPRequest.send(null);
  var xslRef = myXMLHTTPRequest.responseXML;
  xsltProcessor.importStylesheet(xslRef);
}
 
function getRemoteXMLDocument(){
  var myXMLHTTPRequest = new XMLHttpRequest();
  myXMLHTTPRequest.open("GET", "example.xml", false); //syncronous call with last param false
  myXMLHTTPRequest.send(null);
  return myXMLHTTPRequest.responseXML;
}
 
function teszt(){
  var xmlRef = getRemoteXMLDocument();
  var fragment = xsltProcessor.transformToFragment(xmlRef, document);
  var frm = document.getElementById('proba');
  frm.appendChild(fragment);
}

a document változó a böngésző document globális változója