protected function getXSLTProcessor()
    {
        if (isset($this->xsltProcessor)) {
            return $this->xsltProcessor;
        }

        $xslDoc = $this->loadFile($this->stylesheet);

        // Now loading custom xsl stylesheets dynamically.
        // According to XSL spec, each <xsl:import> tag MUST be loaded BEFORE any other element.
        $insertBeforeEl = $xslDoc->documentElement->firstChild;
        foreach ($this->getSortedCustomStylesheets() as $stylesheet) {
            if (!file_exists($stylesheet)) {
                throw new RuntimeException("Cannot find XSL stylesheet for RichText rendering: $stylesheet");
            }

            $newEl = $xslDoc->createElement('xsl:import');
            $hrefAttr = $xslDoc->createAttribute('href');

            // Prevents showing XSLTProcessor::importStylesheet() warning on Windows file system
            $hrefAttr->value = str_replace('\\', '/', $stylesheet);

            $newEl->appendChild($hrefAttr);
            $xslDoc->documentElement->insertBefore($newEl, $insertBeforeEl);
        }
        // Now reload XSL DOM to "refresh" it.
        $xslDoc->loadXML($xslDoc->saveXML());

        $this->xsltProcessor = new XSLTProcessor();
        $this->xsltProcessor->importStyleSheet($xslDoc);
        $this->xsltProcessor->registerPHPFunctions();

        return $this->xsltProcessor;
    }
protected function getXSLTProcessor()
    {
        if (isset($this->xsltProcessor)) {
            return $this->xsltProcessor;
        }

        $xslDoc = $this->loadFile($this->stylesheet);

        // Now loading custom xsl stylesheets dynamically.
        // According to XSL spec, each <xsl:import> tag MUST be loaded BEFORE any other element.
        $insertBeforeEl = $xslDoc->documentElement->firstChild;
        foreach ($this->getSortedCustomStylesheets() as $stylesheet) {
            if (!file_exists($stylesheet)) {
                throw new RuntimeException("Cannot find XSL stylesheet for RichText rendering: $stylesheet");
            }

            $newEl = $xslDoc->createElement('xsl:import');
            $hrefAttr = $xslDoc->createAttribute('href');

            // Prevents showing XSLTProcessor::importStylesheet() warning on Windows file system
            $hrefAttr->value = str_replace('\\', '/', $stylesheet);

            $newEl->appendChild($hrefAttr);
            $xslDoc->documentElement->insertBefore($newEl, $insertBeforeEl);
        }
        // Now reload XSL DOM to "refresh" it.
        $xslDoc->loadXML($xslDoc->saveXML());

        $this->xsltProcessor = new XSLTProcessor();
        $this->xsltProcessor->importStyleSheet($xslDoc);
        $this->xsltProcessor->registerPHPFunctions();

        return $this->xsltProcessor;
    }
protected function getXSLTProcessor ( ) { if ( isset ( $ this -> xsltProcessor ) ) { return $ this -> xsltProcessor ; } $ xslDoc = $ this -> loadFile ( $ this -> stylesheet ) ; // Now loading custom xsl stylesheets dynamically. // According to XSL spec, each <xsl:import> tag MUST be loaded BEFORE any other element. $ insertBeforeEl = $ xslDoc -> documentElement -> firstChild ; foreach ( $ this -> getSortedCustomStylesheets ( ) as $ stylesheet ) { if ( ! file_exists ( $ stylesheet ) ) { throw new RuntimeException ( "Cannot find XSL stylesheet for RichText rendering: $stylesheet" ) ; } $ newEl = $ xslDoc -> createElement ( 'xsl:import' ) ; $ hrefAttr = $ xslDoc -> createAttribute ( 'href' ) ; // Prevents showing XSLTProcessor::importStylesheet() warning on Windows file system $ hrefAttr -> value = str_replace ( '\\' , '/' , $ stylesheet ) ; $ newEl -> appendChild ( $ hrefAttr ) ; $ xslDoc -> documentElement -> insertBefore ( $ newEl , $ insertBeforeEl ) ; } // Now reload XSL DOM to "refresh" it. $ xslDoc -> loadXML ( $ xslDoc -> saveXML ( ) ) ; $ this -> xsltProcessor = new XSLTProcessor ( ) ; $ this -> xsltProcessor -> importStyleSheet ( $ xslDoc ) ; $ this -> xsltProcessor -> registerPHPFunctions ( ) ; return $ this -> xsltProcessor ; }
Returns the XSLTProcessor to use to transform internal XML to HTML5.

@throws \RuntimeException

@return \XSLTProcessor
Returns the XSLTProcessor to use to transform internal XML to HTML5 .