ID:               14965
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Closed
 Bug Type:         Documentation problem
 Operating System: Windows 2000
 PHP Version:      4.1.1
 Assigned To:      k.schroeder
 New Comment:

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------

[2002-10-19 00:40:07] [EMAIL PROTECTED]

Using the xslt_set_base() function as suggested in the May 27 posting
gets around the problem on Win98, too.

------------------------------------------------------------------------

[2002-05-27 21:19:36] [EMAIL PROTECTED]

Using the xslt_set_base() function on Win2k can provide a cleaner
solution to this platform's limitations with Sablotron:

$xh = xslt_create();
xslt_set_base($xh, 'file://' . $DOCUMENT_ROOT . '/examples/');

Note the trailing slash in the above line.

The following line would then work on Win2k:

$result = xslt_process($xh, 'example.xml', 'example.xsl');

------------------------------------------------------------------------

[2002-05-02 00:55:09] [EMAIL PROTECTED]

To get this to work under Win2K and PHP 4.2.0, you must put have
"file://" prefixed to every parameter that requires a file.  This
includes the xml, xsl and the output files.

This does NOT however require to upgrade you php_xslt dll to the
version suggested by the person in bug 14499.

------------------------------------------------------------------------

[2002-04-26 05:23:39] [EMAIL PROTECTED]

Hi, the same problem here on PWS on winodws ME, the code is 
<?php
//create processor
$my_xslt=xslt_create();
//output the processing result
echo
xslt_process($my_xslt,getcwd()."//cd_catalog.xml",getcwd()."\\cd_catalog.xsl");
//free the processor
xslt_free($my_xslt);
?>
returned
Warning: sablotron error on line 1, unknown encoding...

using this code the problem was completely solved...

<?php
//create the processor
$my_xslt=xslt_create();

//process the fiel and echo the result
echo
xslt_process($my_xslt,"file://".getcwd()."//cd_catalog.xml","file://".getcwd()."\\cd_catalog.xsl");


//free the processor
xslt_free($my_xslt);
?>
thank u,

------------------------------------------------------------------------

[2002-01-18 17:25:52] [EMAIL PROTECTED]

Hi folks (please be gentle, my first post to bugs.php.net).

I've got exactly the same mayhem happening on my machine too.  Running
with Apache 1.3.22, and php as a cgi binary.

Here's the example code, commented, shows all that I've found this
evening.  Basically the only way I can get xslt_process() to work is
using the arguments array, putting file names in with getcwd(),
file://, include path just doesn't work :o(

<?

error_reporting (E_ALL);

// My include path is 
// include_path = ".;E:\Webserver\public_html"
//
// PHP is installed to D:\Program Files\Php

$xmlFile="Php.XPathDocumentation.xml"; 
$xslFile="Php.XPathDocumentation.xsl"; 

echo '<hr>Read file<br>';

// Get the contents of the files, 
// Both calls work ok.
$xslData = implode('',file($xslFile));
$xmlData = implode('',file($xmlFile));

echo '<hr>Create parser<br>';

$hXslt = xslt_create();

echo '<hr>Process with filenames (no path)<br>';

// This gives me a error:
// Warning: Sablotron error on line none: cannot open file 
// 'd:/program files/php/Php.XPathDocumentation.xml' 
// in e:\cvs\php.xpath\xpath-develop\doc\Php.XPathDocumentation.php on
line 79
// $result contains nothing
$result = xslt_process($hXslt, $xslFile, $xmlFile);
echo $result;

echo '<hr>Get current working directory<br>';

// This returns e:\cvs\php.xpath\xpath-develop\doc
echo getcwd();

echo '<hr>Use getcwd() and with filenames (no path)<br>';

// Warning: Sablotron error on line 1: unknown encoding '' in 
// e:\cvs\php.xpath\xpath-develop\doc\Php.XPathDocumentation.php on
line 82
// $result contains nothing
$result = xslt_process($hXslt, getcwd().'\\'.$xslFile,
getcwd().'\\'.$xmlFile);
echo $result;

echo '<hr>Use file:// getcwd and with filenames (no path)<br>';

// This call succeeds with no error.
// $result contains the entire xml file unprocessed (whitespace
trimmed).
$result = xslt_process($hXslt, 'file://'.getcwd().'/'.$xslFile,
'file://'.getcwd().'/'.$xmlFile);
echo $result;

echo '<hr>Use the xml and xsl as arguments<br>';

// But this works fine and produces the transformation as I expect
$arguments = array(
     '/_xml' => $xmlData,
     '/_xsl' => $xslData
);
$result = xslt_process($hXslt, 'arg:/_xml', 'arg:/_xsl', NULL,
$arguments);

if ($result) {
    echo $result;
} else {
    echo "There was an error that occurred in the XSL
transformation...\n";
    echo "\tError number: " . xslt_errno() . "\n";
    echo "\tError string: " . xslt_error() . "\n";
    exit;
}

echo '<hr>';

xslt_free($hXslt);

?>

If you want any copies of the files that I've been using, drop me a
mail.  I feel fairly confident that these bugs occur regardless of the
xml and xsl file, given that the final version produces exactly the
expected transformed output. 

Nigel

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/14965

-- 
Edit this bug report at http://bugs.php.net/?id=14965&edit=1


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

Reply via email to