#29219 [Opn->Bgs]: Can't call PHPfunction from XSL
| From: | chregu@php.net | Date: | Sat, 17 Jul 2004 09:22:28 +0000 |
| Subject: | #29219 [Opn->Bgs]: Can't call PHPfunction from XSL | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-62510@lists.php.net to get a copy of this message | ||
ID: 29219
Updated by: chregu@php.net
Reported By: hans dot huber at combats dot de
-Status: Open
+Status: Bogus
Bug Type: XSLT related
Operating System: Linux
PHP Version: 5.0.0
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
You didn't define the PHP namespace...
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:php="http://php.net/xsl"
version='1.0'>
is needed.
Previous Comments:
------------------------------------------------------------------------
[2004-07-17 02:42:58] hans dot huber at combats dot de
Description:
------------
When calling a PHP function from XSL I get a failure
message (see below).
Reproduce code:
---------------
<?php
$xml = '<root></root>';
$xsl = <<<EOT
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<foobar>
<xsl:value-of select="php:function('date', 'r')" />
</foobar>
</xsl:template>
</xsl:stylesheet>
EOT;
$xslt = new xsltProcessor();
$xslt->registerPHPFunctions();
$xslt->importStyleSheet(DomDocument::loadXML($xsl));
print $xslt->transformToXML(DomDocument::loadXML($xml));
?>
Expected result:
----------------
<foobar>Current date</foobar>
Actual result:
--------------
Warning: xmlXPathCompOpEval: function function bound to
undefined prefix php
in /home/hans/tests/php5/xsl/convert.php on line 18
Warning: xmlXPathCompiledEval: 1 object left on the stack
in /home/hans/tests/php5/xsl/convert.php on line 18
<?xml version="1.0"?>
<foobar>r</foobar>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29219&edit=1