ID:               37091
 Updated by:       [EMAIL PROTECTED]
 Reported By:      rob dot eyre at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         XSLT related
 Operating System: Linux
 PHP Version:      5.1.2
 New Comment:

It's not a static method :)

Do

  static function testMethod() {

and it works




Previous Comments:
------------------------------------------------------------------------

[2006-04-15 14:06:29] rob dot eyre at gmail dot com

Description:
------------
After calling registerPHPFunctions() and including the php namespace on
an XSL stylesheet, I can call global functions (eg date()), but not
static class functions (ie testClass::testMethod()).

Reproduce code:
---------------
class testClass {
        function testMethod() {
                return 'testValue';
        }
}
$xslt = new XSLTProcessor;
$xslt->registerPHPFunctions();
$xmlDoc = DOMDocument::loadXML('<root />');

$xslDoc = DOMDocument::loadXML(' 
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:php="http://php.net/xsl";>
        <xsl:template match="/">
                <div><xsl:value-of 
select="php:function(\'testClass::testMethod\')"
/></div>
        </xsl:template>
</xsl:stylesheet>');

$xslt->importStylesheet($xslDoc);
echo $xslt->transformToXML($xmlDoc);

Expected result:
----------------
<div>testValue</div>

Actual result:
--------------
Warning: XSLTProcessor::transformToXml() [function.transformToXml]:
Unable to call handler testClass::testMethod() in
/home/rob/Projects/sandbox/index.php on line 19

Warning: XSLTProcessor::transformToXml() [function.transformToXml]:
xmlXPathCompiledEval: evaluation failed in
/home/rob/Projects/sandbox/index.php on line 19

Warning: XSLTProcessor::transformToXml() [function.transformToXml]:
runtime error: file /home/rob/Projects/sandbox/ line 4 element value-of
in /home/rob/Projects/sandbox/index.php on line 19

Warning: XSLTProcessor::transformToXml() [function.transformToXml]:
xsltValueOf: text copy failed in /home/rob/Projects/sandbox/index.php
on line 19


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=37091&edit=1

Reply via email to