Free Web Hosting Forum
(#1 (permalink))
Old
goalsurfer's Avatar
Member
goalsurfer is on a distinguished road
 
Posts: 45
Join Date: Feb 2009
Unhappy XML - XSL loading stylesheet - 06-18-2009, 05:53 PM

While the programming of a webpage from XML with XSL runs all right in my own server, I get next error message after upload in my account at 000webhost.com:
Fatal error: Class 'XSLTProcessor' not found in /home/[...here follows rest of path...] on line [...line...]
Nevertheless when checking php configuration I saw xml is enabled. Please how to solve this?
Thanks!

Last edited by goalsurfer; 06-18-2009 at 05:56 PM. Reason: hiding path
Reply With Quote
(#2 (permalink))
Old
Senior Member
FnCool is on a distinguished road
 
Posts: 904
Join Date: Feb 2009
Location: Barrie On CA
Default 06-18-2009, 09:02 PM

can you paste some of the code and/or a link?

kind of a far stretch, but it might be the analytics code:
Disabling analytics code
Reply With Quote
(#3 (permalink))
Old
goalsurfer's Avatar
Member
goalsurfer is on a distinguished road
 
Posts: 45
Join Date: Feb 2009
Default 06-18-2009, 09:53 PM

You mean next?

<?php
include_once("class_xslt.php");
$xslt=new Xslt();
$xslt->setXml("worldticketshop.xml"); // or setXmlString($xml) if the xml is in a php string
$xslt->setXsl("worldticketshop.xsl"); // or steXslString($xsl) if the xsl is in a php string
if($xslt->transform()) {
$ret=$xslt->getOutput();
echo $ret;
} else {
print("Error:".$xslt->getError());
}
?>

The xml-file is quite long to give. Do you need xml and xsl too?

Meanwhile I uploaded the xslt class

<?php
// ################################################## ################################
// Title : class_xslt.php
// Version : 1.1
// Author : Luis Argerich (lrargerich@yahoo.com)
// Last modification date : 03-11-2002
// Description : An abstraction class for the XSLT extension
// this one uses the Sablotron processor but we
// may release classes based on other processors
// later.
// ################################################## ################################
// History:
// 03-11-2001 Class modified to work with the new XSLT extension
// 11-11-2001 Class created
// ################################################## ################################
// To-Dos:
// ################################################## ################################
// How to use it:
// include_once("class_xslt.php");
// $xslt=new Xslt();
// $xslt->setXml("applications.xml"); // or setXmlString($xml)
// $xslt->setXsl("tr1.xsl"); // or setXslString($xsl)
// if($xslt->transform()) {
// $ret=$xslt->getOutput();
// echo $ret;
// } else {
// print("Error:".$xslt->getError());
// }
// ################################################## ################################


// CHECK FOR DOUBLE DEFINITION HERE
if(defined("_class_xslt_is_included")) {
// do nothing since the class is already included
} else {
define("_class_xslt_is_included",1);

class Xslt {
var $xsl, $xml, $output, $error ;

/* Constructor */
function xslt() {
$this->processor = xslt_create();
}

/* Destructor */
function destroy() {
xslt_free($this->processor);
}

/* output methods */
function setOutput($string) {
$this->output = $string;
}

function getOutput() {
return $this->output;
}

/* set methods */
function setXmlString($xml) {
$this->xml=$xml;
return true;
}

function setXslString($xsl) {
$this->xsl=$xsl;
return true;
}

function setXml($uri) {
if($doc = new docReader($uri)) {
$this->xml = $doc->getString();
return true;
} else {
$this->setError("Could not open $xml");
return false;
}
}

function setXsl($uri) {
if($doc = new docReader($uri)) {
$this->xsl = $doc->getString();
return true;
} else {
$this->setError("Could not open $uri");
return false;
}
}

/* transform method */
function transform() {
$arguments = array(
'/_xml' => $this->xml,
'/_xsl' => $this->xsl
);
$ret = xslt_process($this->processor, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments);
if(!$ret) {
$this->setError(xslt_error($this->processor));
return false;
} else {
$this->setOutput($ret);
return true;
}
}

/* Error Handling */
function setError($string) {
$this->error = $string;
}

function getError() {
return $this->error;
}
}



/* docReader -- read a file or URL as a string */
/* test */
/*
$docUri = new docReader('http://www.someurl.com/doc.html');
echo $docUri->getString();
*/
class docReader {
var $string; // public string representation of file
var $type; // private URI type: 'file','url'
var $bignum = 1000000;
var $uri;
/* public constructor */
function docReader($uri) { // returns integer $this->setUri($uri);
$this->uri=$uri;
$this->setType();
$fp = fopen($this->getUri(),"r");
if($fp) { // get length
if ($this->getType() == 'file') {
$length = filesize($this->getUri());
} else {
$length = $this->bignum;
}
$this->setString(fread($fp,$length));
return 1;
} else {
return 0;
}
}
/* determine if a URI is a filename or URL */
function isFile($uri) { // returns boolean
if (strstr($uri,'http://') == $uri) {
return false;
} else {
return true;
}
}
/* set and get methods */
function setUri($string) {
$this->uri = $string;
}
function getUri() {
return $this->uri;
}
function setString($string) {
$this->string = $string;
}
function getString() {
return $this->string;
}
function setType() {
if ($this->isFile($this->uri)) {
$this->type = 'file';
} else {
$this->type = 'url';
}
}
function getType() {
return $this->type;
}
}


}
?>

So now there is a slightly different error message, namely "call to undefined function xslt_create()"

Here is the link: http://brusselieren.be/index.php

Last edited by goalsurfer; 06-18-2009 at 09:55 PM. Reason: Add link
Reply With Quote
(#4 (permalink))
Old
Junior Member
cataev is on a distinguished road
 
Posts: 4
Join Date: Dec 2008
Default 06-25-2009, 05:31 AM

I have the same problem.

on the server is not installed XSL extension. this extension is needed for the xml-xslt transformation.

PHP 5 includes the XSL extension by default and can be enabled by adding the argument --with-xsl[=DIR] to your configure line. DIR is the libxslt installation directory.
Reply With Quote
(#5 (permalink))
Old
goalsurfer's Avatar
Member
goalsurfer is on a distinguished road
 
Posts: 45
Join Date: Feb 2009
Default solution with parser - 06-26-2009, 07:27 PM

It's what I understood already. But I found a solution with a parser found on the web named php5-parser. Any other one could be ok too, only this was the first I could work with.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com