php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #15242 PHP functions as extensions for libxslt
Submitted: 2002-01-27 07:36 UTC Modified: 2004-08-27 10:20 UTC
Votes:4
Avg. Score:4.8 ± 0.4
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:2 (50.0%)
From: flying at dom dot natm dot ru Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.1.1 OS: Any
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: flying at dom dot natm dot ru
New email:
PHP Version: OS:

 

 [2002-01-27 07:36 UTC] flying at dom dot natm dot ru
 Since DOM XML extension now have a code to work with libxslt (at least version of DOM XML extension, available in CVS) and libxslt have an ability to create extensions for XSLT it will be absolutely great to allow writing extensions on PHP. 

 Is there any plans to implement this functionality? Because sometimes it is very important.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-28 21:25 UTC] yohgaki@php.net
I don't use it (yet), but it's in PHP now. 
 [2002-02-22 03:39 UTC] flying at dom dot natm dot ru
Current version of DOM XML module, available in CVS only have support for EXSLT, now available into libxslt. But this feature request means adding possibility for PHP developers to define their own extension functions/extension elements for XSLT, written directly in PHP. 
 According to libxslt documentation (http://xmlsoft.org/XSLT/extensions.html) DOM XML module in PHP should have a kind of converter between PHP functions and extension functions for libxslt. From a PHP's point of view it should look like this: 

PHP:
====
<?php
// Creating new stylesheet
$xsl = new XsltStylesheet();
$xsl->register_ns('ext','http://www.my-extensions.com/');
// Register custom extension function
// At enter we give name of it, which will be used in XSLT
// and name of actual PHP function
$xsl->register_extension_function('ext:my_func','myExtension');

function myExtension(p1,p2,p3)
{
  return(p1+p2+p3);
};
?>

XSLT:
=====
.....
<xsl:value-of select="ext:my_func(2,3,4)"/>
.....
 [2002-02-22 04:17 UTC] chregu@php.net
I'm not sure, if this makes sense. You loose the whole interoperability idea of xslt (your stylesheets will only run on PHP) and you will mix again design and logic (ok, xslt allows you to do that already now..). I do see, that it could be quite handy from time to time and maybe i will implement it (some kind of evil eval...), but it's absolutely not on top of my priority list.
 [2002-02-22 04:38 UTC] flying at dom dot natm dot ru
Extensibility is a part os XSLT specification, so i don't see any evilness of this functionality. Yes, it will force some particular XSLT templates to be used only together with PHP, but there is a reason of doing it - speed. You know, XSLT is not a fastest language on the earth :) And, moreover, there is available some small tasks, when one simple function on PHP can solve a problem, much easier, then a bundle on XSLT code.
 I already have some stylesheets, which are executed in 10-15 seconds, while only one small PHP function will reduce their execution time to 1-2 sec. And more extensive usage of XSLT will grow such situations...
 [2004-08-27 10:20 UTC] chregu@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 18 02:01:27 2024 UTC