DHTMLX Docs & Samples Explorer

XSLT with dhtmlxAjax

XSLT - language for transforming XML documents into other XML documents (commonly used for creating HTML from XML). Complete specification of XSLT can be found here. dhtmlxAjax provides two methods for making XSL Transformation:

  • loader.doXSLTransToObject(xslDocument) - makes XSL transformation of XML document which came in request with object as a result;
  • loader.doXSLTransToString(xslDocument) - makes XSL transformation with string representation of a result.

In both cases incoming argument is xslDocument object. It can be loaded with dhtmlxAjax, as xsl is also xml document. Possible variant of usage:

dhtmlxAjax.get("xsl_file.xsl",function(xslLoader){
var xmlLoader = dhtmlxAjax.getSync("xml_file.xml");
some.innerHTML = xmlLoader.doXSLTransToString(xslLoader.xmlDoc.responseXML);
})