protected function transformXML( $content, $path_to_xsl ) {

		libxml_use_internal_errors( true );
		$content = iconv( 'UTF-8', 'UTF-8//IGNORE', $content );

		$xsl = new \DOMDocument();
		$xsl->load( $path_to_xsl );

		$proc = new \XSLTProcessor();
		$proc->importStyleSheet( $xsl );

		$old_value = libxml_disable_entity_loader( true );
		$xml = new \DOMDocument();
		$xml->loadXML( $content );
		libxml_disable_entity_loader( $old_value );

		$content = $proc->transformToXML( $xml );

		$errors = libxml_get_errors(); // TODO: Handle errors gracefully
		libxml_clear_errors();

		return $content;
	}
protected function transformXML( $content, $path_to_xsl ) {

		libxml_use_internal_errors( true );
		$content = iconv( 'UTF-8', 'UTF-8//IGNORE', $content );

		$xsl = new \DOMDocument();
		$xsl->load( $path_to_xsl );

		$proc = new \XSLTProcessor();
		$proc->importStyleSheet( $xsl );

		$old_value = libxml_disable_entity_loader( true );
		$xml = new \DOMDocument();
		$xml->loadXML( $content );
		libxml_disable_entity_loader( $old_value );

		$content = $proc->transformToXML( $xml );

		$errors = libxml_get_errors(); // TODO: Handle errors gracefully
		libxml_clear_errors();

		return $content;
	}
protected function transformXML ( $ content , $ path_to_xsl ) { libxml_use_internal_errors ( true ) ; $ content = iconv ( 'UTF-8' , 'UTF-8//IGNORE' , $ content ) ; $ xsl = new \ DOMDocument ( ) ; $ xsl -> load ( $ path_to_xsl ) ; $ proc = new \ XSLTProcessor ( ) ; $ proc -> importStyleSheet ( $ xsl ) ; $ old_value = libxml_disable_entity_loader ( true ) ; $ xml = new \ DOMDocument ( ) ; $ xml -> loadXML ( $ content ) ; libxml_disable_entity_loader ( $ old_value ) ; $ content = $ proc -> transformToXML ( $ xml ) ; $ errors = libxml_get_errors ( ) ; // TODO: Handle errors gracefully libxml_clear_errors ( ) ; return $ content ; }
Convert an XML string via XSLT file.

@param string $content
@param string $path_to_xsl

@return string
Convert an XML string via XSLT file .