|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-08-08 10:27 UTC] sfs at immune dot dk
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 12:00:01 2025 UTC |
Description: ------------ When using DOM to create a new <xsl:include> and insert it in the xslt document php comes up with a error as seen below. Reproduce code: --------------- <?php $xsl = new DOMDocument('1.0', 'UTF-8'); $test = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> </xsl:stylesheet> EOF; $xsl->loadXML($test); $import = $xsl->createElement('xsl:import'); $import->setAttribute('href', 'login.xsl'); $xsl->documentElement->insertBefore($import, $xsl->documentElement->firstChild); echo $xsl->saveXML(); $html = new XSLTProcessor(); $html->importStylesheet($xsl); ?> Expected result: ---------------- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:import href="login.xsl"/> <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> </xsl:stylesheet> <br /> <b>Warning</b>: Found a top-level element xsl:import with null namespace URI in <b>D:\steffen\frontend\test.php</b> on line <b>23</b><br /> Actual result: -------------- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:import href="login.xsl"/> <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> </xsl:stylesheet>