I have an issue of using PHP 5's XSLTProcessor to manipulate the following XML document. The issue is not the output being processed by the XSLT but elements of the html output are getting xmlns:php="http://php.net/xsl" added to them. An example is below.
The PHP:
$xmldoc = DOMDocument::load($xml);
$xsldoc = DOMDocument::load($xslt);
$proc = new XSLTProcessor();
$proc->registerPHPFunctions();
$proc->importStyleSheet($xsldoc);
echo $proc->transformToXML($xmldoc);
The XML:
<allusers>
<user>
<uid>bob</uid>
</user>
<user>
<uid>tom</uid>
</user>
</allusers>
The XSLT:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:php="http://php.net/xsl"
xsl:extension-element-prefixes="php">
<xsl:output method="html" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="allusers">
<h2>Users</h2>
<table>
<xsl:for-each select="user">
<tr><td>
<xsl:value-of select="php:function ('MyClass::firstLetter',string(.))"/>
</td></tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
And the odd output (notice the xmlns:php="http://php.net/xsl"):
<!DOCTYPE html>
<html>
<head></head>
<body>
<h2 xmlns:php="http://php.net/xsl">Users</h2>
<table xmlns:php="http://php.net/xsl">
<tr><td>b</td></tr>
<tr><td>t</td></tr>
</table>
</body>
</html>
Any ideas? I'm sure that I have all the imports I need and am using them correctly but if someone can show me what or where I'm going wrong, that would be great. Thanks in advance.