private function __process(XsltProcessor $XSLProc, $xml, $xsl, array $parameters = array())
    {
        // Create instances of the DomDocument class
        $xmlDoc = new DomDocument;
        $xslDoc= new DomDocument;

        // Set up error handling
        if (function_exists('ini_set')) {
            $ehOLD = ini_set('html_errors', false);
        }

        // Load the xml document
        set_error_handler(array($this, 'trapXMLError'));
        // Prevent remote entities from being loaded, RE: #1939
        $elOLD = libxml_disable_entity_loader(true);
        // Remove null bytes from XML
        $xml = str_replace(chr(0), '', $xml);
        $xmlDoc->loadXML($xml, LIBXML_NONET | LIBXML_DTDLOAD | LIBXML_DTDATTR | defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0);
        libxml_disable_entity_loader($elOLD);

        // Must restore the error handler to avoid problems
        restore_error_handler();

        // Load the xsl document
        set_error_handler(array($this, 'trapXSLError'));
        // Ensure that the XSLT can be loaded with `false`. RE: #1939
        // Note that `true` will cause `<xsl:import />` to fail.
        $elOLD = libxml_disable_entity_loader(false);
        $xslDoc->loadXML($xsl, LIBXML_NONET | LIBXML_DTDLOAD | LIBXML_DTDATTR | defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0);
        libxml_disable_entity_loader($elOLD);

        // Load the xsl template
        $XSLProc->importStyleSheet($xslDoc);

        // Set parameters when defined
        if (!empty($parameters)) {
            General::flattenArray($parameters);

            $XSLProc->setParameter('', $parameters);
        }

        // Must restore the error handler to avoid problems
        restore_error_handler();

        // Start the transformation
        set_error_handler(array($this, 'trapXMLError'));
        $processed = $XSLProc->transformToXML($xmlDoc);

        // Restore error handling
        if (function_exists('ini_set') && isset($ehOLD)) {
            ini_set('html_errors', $ehOLD);
        }

        // Must restore the error handler to avoid problems
        restore_error_handler();

        return $processed;
    }
private function __process(XsltProcessor $XSLProc, $xml, $xsl, array $parameters = array())
    {
        // Create instances of the DomDocument class
        $xmlDoc = new DomDocument;
        $xslDoc= new DomDocument;

        // Set up error handling
        if (function_exists('ini_set')) {
            $ehOLD = ini_set('html_errors', false);
        }

        // Load the xml document
        set_error_handler(array($this, 'trapXMLError'));
        // Prevent remote entities from being loaded, RE: #1939
        $elOLD = libxml_disable_entity_loader(true);
        // Remove null bytes from XML
        $xml = str_replace(chr(0), '', $xml);
        $xmlDoc->loadXML($xml, LIBXML_NONET | LIBXML_DTDLOAD | LIBXML_DTDATTR | defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0);
        libxml_disable_entity_loader($elOLD);

        // Must restore the error handler to avoid problems
        restore_error_handler();

        // Load the xsl document
        set_error_handler(array($this, 'trapXSLError'));
        // Ensure that the XSLT can be loaded with `false`. RE: #1939
        // Note that `true` will cause `<xsl:import />` to fail.
        $elOLD = libxml_disable_entity_loader(false);
        $xslDoc->loadXML($xsl, LIBXML_NONET | LIBXML_DTDLOAD | LIBXML_DTDATTR | defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0);
        libxml_disable_entity_loader($elOLD);

        // Load the xsl template
        $XSLProc->importStyleSheet($xslDoc);

        // Set parameters when defined
        if (!empty($parameters)) {
            General::flattenArray($parameters);

            $XSLProc->setParameter('', $parameters);
        }

        // Must restore the error handler to avoid problems
        restore_error_handler();

        // Start the transformation
        set_error_handler(array($this, 'trapXMLError'));
        $processed = $XSLProc->transformToXML($xmlDoc);

        // Restore error handling
        if (function_exists('ini_set') && isset($ehOLD)) {
            ini_set('html_errors', $ehOLD);
        }

        // Must restore the error handler to avoid problems
        restore_error_handler();

        return $processed;
    }
private function __process ( XsltProcessor $ XSLProc , $ xml , $ xsl , array $ parameters = array ( ) ) { // Create instances of the DomDocument class $ xmlDoc = new DomDocument ; $ xslDoc = new DomDocument ; // Set up error handling if ( function_exists ( 'ini_set' ) ) { $ ehOLD = ini_set ( 'html_errors' , false ) ; } // Load the xml document set_error_handler ( array ( $ this , 'trapXMLError' ) ) ; // Prevent remote entities from being loaded, RE: #1939 $ elOLD = libxml_disable_entity_loader ( true ) ; // Remove null bytes from XML $ xml = str_replace ( chr ( 0 ) , '' , $ xml ) ; $ xmlDoc -> loadXML ( $ xml , LIBXML_NONET | LIBXML_DTDLOAD | LIBXML_DTDATTR | defined ( 'LIBXML_COMPACT' ) ? LIBXML_COMPACT : 0 ) ; libxml_disable_entity_loader ( $ elOLD ) ; // Must restore the error handler to avoid problems restore_error_handler ( ) ; // Load the xsl document set_error_handler ( array ( $ this , 'trapXSLError' ) ) ; // Ensure that the XSLT can be loaded with `false`. RE: #1939 // Note that `true` will cause `<xsl:import />` to fail. $ elOLD = libxml_disable_entity_loader ( false ) ; $ xslDoc -> loadXML ( $ xsl , LIBXML_NONET | LIBXML_DTDLOAD | LIBXML_DTDATTR | defined ( 'LIBXML_COMPACT' ) ? LIBXML_COMPACT : 0 ) ; libxml_disable_entity_loader ( $ elOLD ) ; // Load the xsl template $ XSLProc -> importStyleSheet ( $ xslDoc ) ; // Set parameters when defined if ( ! empty ( $ parameters ) ) { General :: flattenArray ( $ parameters ) ; $ XSLProc -> setParameter ( '' , $ parameters ) ; } // Must restore the error handler to avoid problems restore_error_handler ( ) ; // Start the transformation set_error_handler ( array ( $ this , 'trapXMLError' ) ) ; $ processed = $ XSLProc -> transformToXML ( $ xmlDoc ) ; // Restore error handling if ( function_exists ( 'ini_set' ) && isset ( $ ehOLD ) ) { ini_set ( 'html_errors' , $ ehOLD ) ; } // Must restore the error handler to avoid problems restore_error_handler ( ) ; return $ processed ; }
Uses `DomDocument` to transform the document. Any errors that
occur are trapped by custom error handlers, `trapXMLError` or
`trapXSLError`.

@param XsltProcessor $XSLProc
An instance of `XsltProcessor`
@param string $xml
The XML for the transformation to be applied to
@param string $xsl
The XSL for the transformation
@param array $parameters
An array of available parameters the XSL will have access to
@return string
Uses DomDocument to transform the document . Any errors that occur are trapped by custom error handlers trapXMLError or trapXSLError .