classes/phing/filters/XsltFilter.php
protected function process($xml, $xsl)
    {
        $processor = new XSLTProcessor();

        // Create and setup document.
        $xmlDom = new DOMDocument();
        $xmlDom->resolveExternals = $this->resolveDocumentExternals;

        // Create and setup stylesheet.
        $xslDom = new DOMDocument();
        $xslDom->resolveExternals = $this->resolveStylesheetExternals;

        if ($this->html) {
            $result = @$xmlDom->loadHTML($xml);
        } else {
            $result = @$xmlDom->loadXML($xml);
        }

        if ($result === false) {
            throw new BuildException('Invalid syntax detected.');
        }

        $xslDom->loadXML($xsl);

        if (defined('XSL_SECPREF_WRITE_FILE')) {
            $processor->setSecurityPrefs(XSL_SECPREF_WRITE_FILE | XSL_SECPREF_CREATE_DIRECTORY);
        }
        $processor->importStylesheet($xslDom);

        // ignoring param "type" attrib, because
        // we're only supporting direct XSL params right now
        foreach ($this->xsltParams as $param) {
            $this->log("Setting XSLT param: " . $param->getName() . "=>" . $param->getExpression(), Project::MSG_DEBUG);
            $processor->setParameter(null, $param->getName(), $param->getExpression());
        }

        $errorlevel = error_reporting();
        error_reporting($errorlevel & ~E_WARNING);
        @$result = $processor->transformToXml($xmlDom);
        error_reporting($errorlevel);

        if (false === $result) {
            //$errno = xslt_errno($processor);
            //$err   = xslt_error($processor);
            throw new BuildException("XSLT Error");
        } else {
            return $result;
        }
    }
protected function process($xml, $xsl)
    {
        $processor = new XSLTProcessor();

        // Create and setup document.
        $xmlDom = new DOMDocument();
        $xmlDom->resolveExternals = $this->resolveDocumentExternals;

        // Create and setup stylesheet.
        $xslDom = new DOMDocument();
        $xslDom->resolveExternals = $this->resolveStylesheetExternals;

        if ($this->html) {
            $result = @$xmlDom->loadHTML($xml);
        } else {
            $result = @$xmlDom->loadXML($xml);
        }

        if ($result === false) {
            throw new BuildException('Invalid syntax detected.');
        }

        $xslDom->loadXML($xsl);

        if (defined('XSL_SECPREF_WRITE_FILE')) {
            $processor->setSecurityPrefs(XSL_SECPREF_WRITE_FILE | XSL_SECPREF_CREATE_DIRECTORY);
        }
        $processor->importStylesheet($xslDom);

        // ignoring param "type" attrib, because
        // we're only supporting direct XSL params right now
        foreach ($this->xsltParams as $param) {
            $this->log("Setting XSLT param: " . $param->getName() . "=>" . $param->getExpression(), Project::MSG_DEBUG);
            $processor->setParameter(null, $param->getName(), $param->getExpression());
        }

        $errorlevel = error_reporting();
        error_reporting($errorlevel & ~E_WARNING);
        @$result = $processor->transformToXml($xmlDom);
        error_reporting($errorlevel);

        if (false === $result) {
            //$errno = xslt_errno($processor);
            //$err   = xslt_error($processor);
            throw new BuildException("XSLT Error");
        } else {
            return $result;
        }
    }
protected function process ( $ xml , $ xsl ) { $ processor = new XSLTProcessor ( ) ; // Create and setup document. $ xmlDom = new DOMDocument ( ) ; $ xmlDom -> resolveExternals = $ this -> resolveDocumentExternals ; // Create and setup stylesheet. $ xslDom = new DOMDocument ( ) ; $ xslDom -> resolveExternals = $ this -> resolveStylesheetExternals ; if ( $ this -> html ) { $ result = @ $ xmlDom -> loadHTML ( $ xml ) ; } else { $ result = @ $ xmlDom -> loadXML ( $ xml ) ; } if ( $ result === false ) { throw new BuildException ( 'Invalid syntax detected.' ) ; } $ xslDom -> loadXML ( $ xsl ) ; if ( defined ( 'XSL_SECPREF_WRITE_FILE' ) ) { $ processor -> setSecurityPrefs ( XSL_SECPREF_WRITE_FILE | XSL_SECPREF_CREATE_DIRECTORY ) ; } $ processor -> importStylesheet ( $ xslDom ) ; // ignoring param "type" attrib, because // we're only supporting direct XSL params right now foreach ( $ this -> xsltParams as $ param ) { $ this -> log ( "Setting XSLT param: " . $ param -> getName ( ) . "=>" . $ param -> getExpression ( ) , Project :: MSG_DEBUG ) ; $ processor -> setParameter ( null , $ param -> getName ( ) , $ param -> getExpression ( ) ) ; } $ errorlevel = error_reporting ( ) ; error_reporting ( $ errorlevel & ~ E_WARNING ) ; @ $ result = $ processor -> transformToXml ( $ xmlDom ) ; error_reporting ( $ errorlevel ) ; if ( false === $ result ) { //$errno = xslt_errno($processor); //$err   = xslt_error($processor); throw new BuildException ( "XSLT Error" ) ; } else { return $ result ; } }
Try to process the XSLT transformation

@param string $xml XML to process.
@param string $xsl XSLT sheet to use for the processing.

@return string

@throws BuildException On XSLT errors
Try to process the XSLT transformation