protected static function loadAsHTML($template)
	{
		$template = self::replaceCDATA($template);

		$dom  = new DOMDocument;
		$html = '<?xml version="1.0" encoding="utf-8" ?><html><body><div>' . $template . '</div></body></html>';

		$useErrors = libxml_use_internal_errors(true);
		$dom->loadHTML($html, LIBXML_NSCLEAN);
		self::removeInvalidAttributes($dom);
		libxml_use_internal_errors($useErrors);

		// Now dump the thing as XML then reload it with the proper root element
		$xml = '<?xml version="1.0" encoding="utf-8" ?><xsl:template xmlns:xsl="' . self::XMLNS_XSL . '">' . self::innerXML($dom->documentElement->firstChild->firstChild) . '</xsl:template>';

		$useErrors = libxml_use_internal_errors(true);
		$dom->loadXML($xml, LIBXML_NSCLEAN);
		libxml_use_internal_errors($useErrors);

		return $dom;
	}
protected static function loadAsHTML($template)
	{
		$template = self::replaceCDATA($template);

		$dom  = new DOMDocument;
		$html = '<?xml version="1.0" encoding="utf-8" ?><html><body><div>' . $template . '</div></body></html>';

		$useErrors = libxml_use_internal_errors(true);
		$dom->loadHTML($html, LIBXML_NSCLEAN);
		self::removeInvalidAttributes($dom);
		libxml_use_internal_errors($useErrors);

		// Now dump the thing as XML then reload it with the proper root element
		$xml = '<?xml version="1.0" encoding="utf-8" ?><xsl:template xmlns:xsl="' . self::XMLNS_XSL . '">' . self::innerXML($dom->documentElement->firstChild->firstChild) . '</xsl:template>';

		$useErrors = libxml_use_internal_errors(true);
		$dom->loadXML($xml, LIBXML_NSCLEAN);
		libxml_use_internal_errors($useErrors);

		return $dom;
	}
protected static function loadAsHTML ( $ template ) { $ template = self :: replaceCDATA ( $ template ) ; $ dom = new DOMDocument ; $ html = '<?xml version="1.0" encoding="utf-8" ?><html><body><div>' . $ template . '</div></body></html>' ; $ useErrors = libxml_use_internal_errors ( true ) ; $ dom -> loadHTML ( $ html , LIBXML_NSCLEAN ) ; self :: removeInvalidAttributes ( $ dom ) ; libxml_use_internal_errors ( $ useErrors ) ; // Now dump the thing as XML then reload it with the proper root element $ xml = '<?xml version="1.0" encoding="utf-8" ?><xsl:template xmlns:xsl="' . self :: XMLNS_XSL . '">' . self :: innerXML ( $ dom -> documentElement -> firstChild -> firstChild ) . '</xsl:template>' ; $ useErrors = libxml_use_internal_errors ( true ) ; $ dom -> loadXML ( $ xml , LIBXML_NSCLEAN ) ; libxml_use_internal_errors ( $ useErrors ) ; return $ dom ; }
Load given HTML template in a DOM document

@param  string      $template Original template
@return DOMDocument
Load given HTML template in a DOM document