The correct way to receive DOM nodes (let it be element, document, document fragment etc.) returned from PHP is to use <xsl:copy-of select="php:function...
I found the idea and an example here: http://bugs.php.net/bug.php?id=29409
For the technical details about the reason, see http://www.w3.org/TR/xslt#copy-of