public function transformToHTML($xml)
    {
        if (is_string($xml)) {
            $dom = new DOMDocument();
            $dom->load($xml);
        } else {
            $dom = $xml;
        }
        $out = $this->xsltProcessor->transformToXML($dom);

        // fudges for HTML backwards compatibility
        // assumes that document is XHTML
        $out = str_replace('/>', ' />', $out); // <br /> not <br/>
        $out = str_replace(' xmlns=""', '', $out); // rm unnecessary xmlns

        if (class_exists('Tidy')) {
            // cleanup output
            $config = array(
                'indent'        => true,
                'output-xhtml'  => true,
                'wrap'          => 80
            );
            $tidy = new Tidy;
            $tidy->parseString($out, $config, 'utf8');
            $tidy->cleanRepair();
            $out = (string) $tidy;
        }

        return $out;
    }
public function transformToHTML($xml)
    {
        if (is_string($xml)) {
            $dom = new DOMDocument();
            $dom->load($xml);
        } else {
            $dom = $xml;
        }
        $out = $this->xsltProcessor->transformToXML($dom);

        // fudges for HTML backwards compatibility
        // assumes that document is XHTML
        $out = str_replace('/>', ' />', $out); // <br /> not <br/>
        $out = str_replace(' xmlns=""', '', $out); // rm unnecessary xmlns

        if (class_exists('Tidy')) {
            // cleanup output
            $config = array(
                'indent'        => true,
                'output-xhtml'  => true,
                'wrap'          => 80
            );
            $tidy = new Tidy;
            $tidy->parseString($out, $config, 'utf8');
            $tidy->cleanRepair();
            $out = (string) $tidy;
        }

        return $out;
    }
public function transformToHTML ( $ xml ) { if ( is_string ( $ xml ) ) { $ dom = new DOMDocument ( ) ; $ dom -> load ( $ xml ) ; } else { $ dom = $ xml ; } $ out = $ this -> xsltProcessor -> transformToXML ( $ dom ) ; // fudges for HTML backwards compatibility // assumes that document is XHTML $ out = str_replace ( '/>' , ' />' , $ out ) ; // <br /> not <br/> $ out = str_replace ( ' xmlns=""' , '' , $ out ) ; // rm unnecessary xmlns if ( class_exists ( 'Tidy' ) ) { // cleanup output $ config = array ( 'indent' => true , 'output-xhtml' => true , 'wrap' => 80 ) ; $ tidy = new Tidy ; $ tidy -> parseString ( $ out , $ config , 'utf8' ) ; $ tidy -> cleanRepair ( ) ; $ out = ( string ) $ tidy ; } return $ out ; }
Transforms an XML file into compatible XHTML based on the stylesheet
@param $xml XML DOM tree, or string filename
@return string HTML output
@todo Rename to transformToXHTML, as transformToHTML is misleading
Transforms an XML file into compatible XHTML based on the stylesheet