note 48765 added to function.xsl-xsltprocessor-transform-to-xml
| From: | jlippsatmac at osu1 dot php dot net | Date: | Thu, 06 Jan 2005 16:05:46 +0000 |
| Subject: | note 48765 added to function.xsl-xsltprocessor-transform-to-xml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-82842@lists.php.net to get a copy of this message | ||
transformToXML, if you have registered PHP functions previously, does indeed attempt to execute
these functions when it finds them in a php:function() pseudo-XSL function. It even finds static
functions within classes, for instance:
<xsl:value-of select="php:function('MyClass::MyFunction', string(@attr),
string(.))" disable-output-escaping="yes"/>
However, in this situation transformToXML does not try to execute "MyClass::MyFunction()".
Instead, it executes "myclass:myfunction()". In PHP, since classes and functions are (I
think) case-insensitive, this causes no problems.
A problem arises when you are combining these features with the __autoload() feature. So, say I have
MyClass.php which contains the MyFunction definition. Generally, if I call MyClass::MyFunction, PHP
will pass "MyClass" to __autoload(), and __autoload() will open up
"MyClass.php".
What we have just seen, however, means that transformToXML will pass "myclass" to
__autoload(), not "MyClass", with the consequence that PHP will try to open
"myclass.php", which doesn't exist, instead of "MyClass.php", which does.
On case-insensitive operating systems, this is not significant, but on my RedHat server, it is--PHP
will give a file not found error.
The only solution I have found is to edit the __autoload() function to look for class names which
are used in my XSL files, and manually change them to the correct casing.
Another solution, obviously, is to use all-lowercase class and file names.
----
Manual Page -- http://www.php.net/manual/en/function.xsl-xsltprocessor-transform-to-xml.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+48765
Delete -- http://master.php.net/manage/user-notes.php?action=delete+48765&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48765&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48765&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48765&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48765&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48765&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+48765&report=yes
Search -- http://master.php.net/manage/user-notes.php