public function __construct($data, $parent = null) { if ($data instanceof XMLRestResponseBase) { $datatype = $data->getParent()->datatype; if ($data->isFragment()) { $data = $data->finalize(); } $result = $data->getData(); if (is_array($result)) { $result = implode('', $result); } exec("bash " . RestAPIHelper::getFolder(RestFolderEnum::FE_XSL_FOLDER) . "group.xsl.template {$datatype}", $xf); $xf = implode("\n", $xf); $xsl = new DOMDocument(); $xsl->loadXML($xf); $proc = new XSLTProcessor(); $proc->registerPHPFunctions(); $proc->importStylesheet($xsl); $xml = new DOMDocument(); $xml->loadXML($result, LIBXML_NSCLEAN | LIBXML_COMPACT); $result = $proc->transformToXml($xml); $xf = RestAPIHelper::getFolder(RestFolderEnum::FE_XSL_FOLDER) . 'strip_prefix.xsl'; $xsl = new DOMDocument(); $xsl->load($xf); $proc = new XSLTProcessor(); $proc->registerPHPFunctions(); $proc->importStylesheet($xsl); $xml = new DOMDocument(); $xml->loadXML($result, LIBXML_NSCLEAN | LIBXML_COMPACT); $result = $proc->transformToXml($xml); $xf = RestAPIHelper::getFolder(RestFolderEnum::FE_XSL_FOLDER) . 'text2att.xsl'; $xsl = new DOMDocument(); $xsl->load($xf); $proc = new XSLTProcessor(); $proc->registerPHPFunctions(); $proc->importStylesheet($xsl); $xml = new DOMDocument(); $xml->loadXML($result, LIBXML_NSCLEAN | LIBXML_COMPACT); $result = $proc->transformToXml($xml); $xf = RestAPIHelper::getFolder(RestFolderEnum::FE_XSL_FOLDER) . 'att2elem.xsl'; $xsl = new DOMDocument(); $xsl->load($xf); $proc = new XSLTProcessor(); $proc->registerPHPFunctions(); $proc->importStylesheet($xsl); $xml = new DOMDocument(); $xml->loadXML($result, LIBXML_NSCLEAN | LIBXML_COMPACT); $result = $proc->transformToXml($xml); $xf = RestAPIHelper::getFolder(RestFolderEnum::FE_XSL_FOLDER) . 'remove_empty_nodes.xsl'; $xsl = new DOMDocument(); $xsl->load($xf); $proc = new XSLTProcessor(); $proc->registerPHPFunctions(); $proc->importStylesheet($xsl); $xml = new DOMDocument(); $xml->loadXML($result, LIBXML_NSCLEAN | LIBXML_COMPACT); $result = $proc->transformToXml($xml); $xf = RestAPIHelper::getFolder(RestFolderEnum::FE_XSL_FOLDER) . 'xml2json.xsl'; $xsl = new DOMDocument(); $xsl->load($xf); $proc = new XSLTProcessor(); $proc->registerPHPFunctions(); $proc->importStylesheet($xsl); $xml = new DOMDocument(); $xml->loadXML($result, LIBXML_NSCLEAN | LIBXML_COMPACT); $result = $proc->transformToXml($xml); $data = $result; } parent::__construct($data, $parent); }