ID: 15242 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Analyzed Bug Type: Feature/Change Request Operating System: Any PHP Version: 4.1.1 New Comment:
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... Previous Comments: ------------------------------------------------------------------------ [2002-02-22 04:17:10] [EMAIL PROTECTED] 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 03:39:44] [EMAIL PROTECTED] 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-01-28 21:25:32] [EMAIL PROTECTED] I don't use it (yet), but it's in PHP now. ------------------------------------------------------------------------ [2002-01-27 07:36:22] [EMAIL PROTECTED] 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. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=15242&edit=1