note 29306 added to ref.xslt
| From: | ben*_onshop at rack1 dot php dot net | Date: | Sun, 09 Feb 2003 14:11:23 +0000 |
| Subject: | note 29306 added to ref.xslt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-43682@lists.php.net to get a copy of this message | ||
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);
--
http://www.php.net/manual/en/ref.xslt.php
http://master.php.net/manage/user-notes.php?action=edit+29306
http://master.php.net/manage/user-notes.php?action=delete+29306
http://master.php.net/manage/user-notes.php?action=reject+29306