I am using PHP with XSL and registerPHPfunctions.
It is ok for return PHP string values with xsl:value-of, but I not know how to return XML fragments from PHP.
Example at XSLT:
<xsl:template match="table">
<xsl:copy-of select="php:function('myfunc',.)"/>
</xsl:template>
Example at PHP:
function myfunc($x) {return '<table><tr><td>ok</td></tr></table>';}
Result is not XML but a "lt/gt/amp enconded XML". Use of copy-of or value-of at XSL, not modify the return behaviour. It is a cast problem?
PS: even with identity function, I tested, it not returns the XML node,
function myfunc($x) {return $x;}
<xsl:value-of select="php:function('myfunc') disable-output-escaping="yes" />for that. But to use it is considered bad practice - and its not working with PHP :| ( I tested with 5.3.10 Ubuntu 12.04). I would advice you to create the<xml>nodes in the xsl not in the php functions. But however I don't know your application needsdisable-output-escapingon my PHP environment and, also, not working... How to submit a "feature request" to PHP community? PHP not have XSLT2 or xQuery, so it is very important to PHP-XML users... Well, for my application I need to return nodes (not only string-values).<xsl:if>for example to create the xml tree in xsl depending on the return value of a php function