How do I return a node-set via php:function?
I've had no difficulty returning strings, but xsl refuses to see the result as something I can iterate as real XML.
PHP 5.1.2 ; libxml 2.6.22
php fragment:
function getNodes() {
return '<RESULT>'
. ' <NODE>foo</NODE>'
. ' <NODE>bar</NODE>
. '</RESULT>';
}
xsl fragment:
<xsl:variable name="nodes">
<xsl:copy-of select="php:function('getNodes')" />
</xsl:variable>
cnt=<xsl:value-of select="count($nodes/RESULT/NODE)" />
expected output: cnt=2
actual output: cnt=0
This is because the xsl variable "nodes" contains a string rather than an actual node-set.
I also tried this, but libxml2 evidently does not support this URI form:
<xsl:variable name="tmp">
<xsl:value-of select="php:function('getNodes')" />
</xsl:variable>
<xsl:copy-of select="document(concat('data:text/xml,',$tmp))" />
Any help would be greatly appreciated.
thanks