Hello,

I am using php 4.2.0 and apache 2.0 on win95. I am facing some problems with
xslt extension. Problem is that xslt processor is unable to find the xml and
xsl files.
Files are in the same directory as the php file and document_root is
e:\wwwroot\newsite.

So when I do something like:

//////////////////////////////
$proc = xslt_create();
xslt_process($proc, "ptable.xml", "ptable.xsl", "ptable.html");
////////////////////////////////

It tries to find file under some other directory:

///////////////////////////////////////////////////
Warning: Sablotron error on line none: cannot open file
'D:/WINDOWS/SYSTEM/inetsrv/ptable.xsl' in E:\web\newsite\transxml.php on
line 17
//////////////////////////////////////////////////////

But readfile("ptable.xml"); is able to read the file and display its
contents.

Then I changed file paths like this:

/////////////////////////////////////////////
xslt_process($proc, "\ptable.xml", "\ptable.xsl", "\ptable.html");
/////////////////////////////////////////////////

and it searched for files under d:\.

So, I copied both files under d:\ and transformation worked and ptable.html
was created.

But because I wanted these files to be in the original directory I changed
it like this:

/////////////////////////////////////////////////////////////////
$xml_file = stripslashes($_SERVER["DOCUMENT_ROOT"])."\ptable.xml";
$xsl_file = stripslashes($_SERVER["DOCUMENT_ROOT"])."\ptable.xsl";
$html_file = stripslashes($_SERVER["DOCUMENT_ROOT"])."\ptable.html";
echo $xml_file, "<br>";
echo $xsl_file, "<br>";
echo $html_file, "<br>";
$proc = xslt_create();

if (xslt_process($proc, $xml_file, $xsl_file, $html_file))
{
    echo "File ptable.xml has been transformed using ptable.xsl";
    echo "Contents of this file are:";
    readfile("ptable.html");
}
else
{
    echo "Some error occurred<br>";
    echo "Error is: ", xslt_error($proc);
    echo "<br>Error number is: ", xslt_errno($proc);
}
xslt_free($proc);
//////////////////////////////////////////////////////////////////

Result is:

//////////////////////////
E:\web\newsite\ptable.xml
E:\web\newsite\ptable.xsl
E:\web\newsite\ptable.html

Warning: Sablotron error on line 1: unknown encoding '' in
E:\web\newsite\transxml.php on line 22
Some error occured
Error is: unknown encoding ''
Error number is: 66
////////////////////////////

But there is no encoding problem etc. because it created output file when
files were copied to d:\ as mentioned above.

Sukhwinder Singh


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to