php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29219 Can't call PHPfunction from XSL
Submitted: 2004-07-17 02:42 UTC Modified: 2004-07-17 11:22 UTC
From: hans dot huber at combats dot de Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 5.0.0 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: hans dot huber at combats dot de
New email:
PHP Version: OS:

 

 [2004-07-17 02:42 UTC] 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> 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-17 11:22 UTC] chregu@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 07:01:28 2024 UTC