|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-04-11 17:58 UTC] chregu@php.net
[2006-04-11 17:58 UTC] chregu@php.net
[2006-04-11 18:12 UTC] php at xmlnode dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 17:00:02 2025 UTC |
Description: ------------ It seems that libxml_get_last_error always has an error after importing a perfectly valid, well-formed, xsl stylesheet. This makes it difficult to determine if there is really a problem with the stylesheet versus 'noise'. :( Reproduce code: --------------- <?php libxml_use_internal_errors(true); $x = new DomDocument; $y = new XSLTProcessor; $x->load('foo.xsl'); $y->importStyleSheet($x); var_dump(libxml_get_last_error()); // not needed to show the problem, but if uncommented works // $x->loadxml('<FOO />'); // echo $y->transformToXML($x); ?> // the stylesheet which opens without error in other parsers <?xml version="1.0" encoding="ISO-8859-1" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" encoding="iso-8859-1" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" /> <xsl:template match="/"> hi </xsl:template> </xsl:stylesheet> Expected result: ---------------- No errors. In fact, if you comment the vardump and uncomment the last two lines of the reproducable code above, it will transform the document as expected, but there's still an error in libxml. I recognize that libxml is outside of your immediate jurisdiction, but was hoping you could alter libxml_get_last_error to be smarter or something... not sure what I'm hoping for exactly. Actual result: -------------- object(LibXMLError)#3 (6) { ["level"]=> int(3) ["code"]=> int(77) ["column"]=> int(1) ["message"]=> string(47) "Premature end of data in tag stylesheet line 2 " ["file"]=> string(37) "file:///c%3A/xampplite/htdocs/foo.xsl" ["line"]=> int(11) }