ID: 34034 User updated by: sfs at immune dot dk Reported By: sfs at immune dot dk -Status: Open +Status: Bogus Bug Type: XSLT related Operating System: Windows XP SP2 PHP Version: 5.0.4 New Comment:
You have to use DOMDocument::createElementNS instead, if anyone have the same problem see: http://bugs.php.net/bug.php?id=29811 and http://www.ctindustries.net/dom/domxsl.txt Previous Comments: ------------------------------------------------------------------------ [2005-08-08 10:19:15] sfs at immune dot dk 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> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34034&edit=1
