doc = new \SimpleXMLElement("<$rootElement/>"); foreach (self::$runFirst as $fn) { $fn($this->doc); } } function sendRaw() { header('Content-Type: application/xml'); echo $this->doc->asXML(); } function send() { if (isset($_GET['RawXML'])) { $this->sendRaw(); return; } //header('Content-Type: application/xhtml+xml'); $processor = new \XSLTProcessor; foreach (self::$stylesheets as $sheet) { $processor->importStylesheet($sheet); } $root = \Dom\import_simplexml($this->doc); echo $processor->transformToXml($root); } }