[PHP-users 11887] xslt_process関数で相対パスでファイルを指定できない

Kosuke Tanabe php-users@php.gr.jp
2002年11月29日 00:06:59 +0900


田辺と申します。
XSLT関数のことについて質問させてください。
以下のようなファイルを用意しています。
$ ls -l /home/httpd/html
-rw-r--r-- 1 tanabe tanabe 218 2002年11月28日 23:31 test.php
-rw-r--r-- 1 tanabe tanabe 70 2002年11月28日 23:32 test.xml
-rw-r--r-- 1 tanabe tanabe 316 2002年11月28日 23:37 test.xsl
[test.xml]
<?xml version="1.0" encoding="utf-8"?>
<aaa>
 <bbb>test</bbb>
</aaa>
[test.xsl]
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" encoding="utf-8" indent="yes" />
 <xsl:template match="/">
 <html>
 <body>
 <p><xsl:value-of select="aaa/bbb" /></p>
 </body>
 </html>
 </xsl:template>
</xsl:stylesheet>
[test.php]
<?php
$xml_file = 'test.xml';
$xsl_file = 'test.xsl';
$xslt = xslt_create();
$data = xslt_process($xslt, $xml_file, $xsl_file);
xslt_free($xslt);
echo $data;
?>
ここでtest.phpのxslt_processの引数であるXML/XSLファイルのパスを相対指
定して、ブラウザでtest.phpにアクセスすると、
WWarning: Sablotron error on line none: cannot open file '/test.xsl' 
in /home/tanabe/public_html/xml/test.php on line 5
と、エラーが出てしまいます。一方、
$xml_file = '/home/tanabe/public_html/xml/test.xml';
$xsl_file = '/home/tanabe/public_html/xml/test.xsl';
のように、パスを両方絶対指定にすると、正常に"test"と表示されます。
xslt_processのマニュアルやサンプルでは相対指定で記述されていますが、ど
こか設定で見落としているところがあるのでしょうか? 検索エンジンで調べ
てみたのですが、同様の事例は発見できませんでした。
なお、OSはLinux(Debian sid)、Apacheのバージョンは2.0.43、PHPのバージョ
ンは4.3.0RC2、sablotronのバージョンは0.96で、いずれもソースからインス
トールしています。
また、PHPのコンパイルオプションは以下の通りです。
'./configure' '--enable-xslt' '--with-xslt-sablot=/usr/local' 
'--with-dom=/usr' '--with-expat-dir=/usr' '--with-zlib' 
'--with-apxs2=/usr/local/apache2/bin/apxs'
-- 
Kosuke Tanabe mailto:nabegyu@hh.iij4u.or.jp

AltStyle によって変換されたページ (->オリジナル) /