ID: 47101 Updated by: rricha...@php.net Reported By: php at mycel dot nl -Status: Open +Status: Bogus Bug Type: DOM XML related Operating System: Ubuntu 8.10, Windows XP PHP Version: 5.2.8 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php You need to use DOM Level 2 NS aware methods (setAttributeNS) and properly create the namespace declaration in the XMLNS namespace Previous Comments: ------------------------------------------------------------------------ [2009-01-14 15:35:12] php at mycel dot nl Description: ------------ If you add a new namespace to the DOM Document then the XSLT gives an error "undefined namespace". And if you save the DOM and load again it works. Reproduce code: --------------- $oDOM = new DOMDocument(); $oDOM->load('random_file.xsl'); //Must be a valid XSL file with a <xsl:stylesheet> tag $oDOM2 = new DOMDocument(); $oDOM2->load('random_file.xml'); //Must be a valid XML file $oElement = $oDOM->getElementsbyTagNameNS('*', 'stylesheet')->item(0); $oElement->setAttribute('xmlns:exsl', 'http://exslt.org/common'); $oXSLTransform = new XSLTProcessor(); $oXSLTransform->importStyleSheet($oDOM); $oOutput = $oXSLTransform->transformToDoc($oDOM); Expected result: ---------------- A transformed DOC document (without errors) Actual result: -------------- Warning: XSLTProcessor::importStylesheet() [xsltprocessor.importstylesheet]: compilation error: file file.xsl line 3 element stylesheet in file.php on line 13 Warning: XSLTProcessor::importStylesheet() [xsltprocessor.importstylesheet]: xsl:extension-element-prefix : undefined namespace exsl in file.php on line 13 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47101&edit=1