note 29306 deleted from ref.xslt by didou
| From: | didou@php.net | Date: | Tue, 11 May 2004 22:06:20 +0000 |
| Subject: | note 29306 deleted from ref.xslt by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-69494@lists.php.net to get a copy of this message | ||
Note Submitter: ben*_onshop co'uk
----
For Win32 problems with XSLT processing error: cannot open file '<apache
dir>/apache/<xsl file>' errors:
In the documentation for xslt_set_base it states:
'for As of 4.3, the default base URI is the directory of the executing script'
However using 4.3, if I execute:
$xsltHandle = xslt_create();
$html = xslt_process($xsltHandle, 'test.xml', 'test.xsl');
XSLT processing error: cannot open file 'c:/phpdev/apache/test.xsl'
My XSL file is actually in the same directory as the php file which is
'c:\web\sites\xsltest'
So PHP is not looking for the script in the same directory of the executing script but rather in the
apache directory!
I had to write a work around to fix this. Place the following after the xslt_create() statement to
get it to work:
$path = $_SERVER['SCRIPT_FILENAME'];
$path = substr($path,0,strrpos($path, '/')+1);
xslt_set_base($xsltHandle, "file://".$path);