Let's start with the problem:

I am creating a XML-based CMS that has to run on the servers of French internet service provider and web host Free.fr. So I can't use SimpleXML as only a handul of functions are activated.

I can only assume that it is the old XSLT module but I can't seem to install it into my XAMPP so I can develop and test my code offline. (The alternative of uploading the files after each change is too time-consuming.) The XSLT functions seem to work on the server - hence my assumption.

First way was to search DaniWeb and I found the old thread How do I install Sablotron with PHP? - created in 2004, first answer September 2009, referring to the Ginger Alliance website which has been inaccessible to me ever since I started to look for Sablotron.

So I had scramble it together myself.

I found Sablotron for Windows v1.0.1 on WareSeeker, The Expat XMP Parser v2.0.1 on www.libexpat.org and a compiled iconv library by GnuGP. Sablotron and iconv library were simply to extract (I think) and so I did (to drive:\xampp\php). The Expat application I did install but there's no expat.dll and no lib directory so I took the libexpat.dll file, copied to the same PHP directory of XAMPP and renamed it to expat.dll. Then I added the xampp\php directory to the Windows system PATH (as described by PHP.net).

But, naturally, it ain't working. Then I read on PHP's instruction page that "[t]his extension has been moved to the » PECL repository and is no longer bundled with PHP as of PHP 5.0.0." But there's no XSLT extension.

So, what can I do to install the necessary extensions and functions so I can do the work on my local XAMPP server?

Thank you.

P.S. I use XAMPP for Windows v1.7.3.

Member Avatar for diafol

Yep, looked into Sablotron - for PHP4 from what I could see. PHP5 -> PECL.

//edit

Sorry -> PEAR

http://pear.php.net/package/XML_XSLT_Wrapper

Wrapper for xslt commands - mentions Sablotron

Okay, but how can I install that? The tutorial on PEAR is, well, I would have said a "mess" but let's try to be constructive and say that checking if PEAR works has nothing to do with what I get (it seems to be written for Linux and not for Windows).

I can do the $ pear version part but $ pear config-get php_dir /usr/share/lib/php/ will fail (I used this and that: $ pear config-get php_dir ). $ php --ini will work, $ php -c /path/to/php.ini -r 'echo get_include_path()."\n";' won't. The next point, including a file, will result in bool(true) as it should but I stopped there.

For manual installation I have no idea where to put the downloaded files nor how to use them.

Any ideas?

Okay, minor addition, I tried it and it seems that PEAR was installed and set up alright. So pear install XML_XSLT_Wrapper-0.2.2 at least is working.

Now, can I use it?

require_once 'XML\XSLT\Wrapper.php';

...does not make any difference, I still get:

Fatal error: Call to undefined function xslt_create() in G:\xampp\htdocs\site\php-xml-xslt.php on line 6
Member Avatar for diafol

May be your path, try the absolute docroot path:

require_once "{whatever it is}\XML\XSLT\Wrapper.php";

I know this isn't how PEAR is supposed to work, but hey - like you said PEAR+Windows = problem for me too. You could probably place the wrapper.php file in a subfolder and reference it from there? Dunno. Anybody else?

I tried now multiple ways of including Wrapper.php - full Windows document path (I knew it couldn't work but I tried anyway), the supposed path or the path with PEAR\XML\XSLT\Wrapper.php (said that such a folder/file does not exist); I even put the files and folders in the htdocs folder so it would be directly available on localhost. Nothing works.

I verified whether the function is question (xslt_create()) exists or not. Yes, in XSLT_ext.php there's a reference to this function (in the definition of function Backend_XSLT_ext()) so I guess it's not a missing/wrong function but indeed the point that PEAR's XML_XSLT_Wrapper is not included.

Due to all these difficulties I feel it's best to try and create my own functions that read/load XML data and XSLT contents to create an XHTML output. This way I should be certain that it'll work on any server.

Any idea whether this or something similar has been discussed already? (Please, provide links to the thread(s) if you want to answer! Thank you.)

Of course, if you feel there's a solution to including the Wrapper, by all means, share it!

Member Avatar for diafol

The wrapper.php file tries to include PEAR.php - so if this isn't in the same folder - it won't work. Any chance of including the PEAR.php file for now, just to see? The time involved with creating your own functions would be massive (IMO). Obvioulsy there MUST be a way of getting it to work.

//edit - no stow that - moving pear.php won't do it.

Member Avatar for diafol

//UPDATE
Just redid my PEAR directory:
http://www.geeksengine.com/article/install-pear-on-windows.html

I've got XAMPP - so all references to c:\winnt actually refer to the php.ini files under XAMPP itself (there were a couple! So I checked them all)

I downloaded the Text-Highlighter module as suggested and got it to work after a fiddle.

The problem was that it states that PEAR.php file has to be copied to the PEAR dir, but forgot to mention that PEAR5.php has to be copied there too.

I tried wrapper - but get same message as you - can't find class - although present. It certainly finds the file (via php include path - PEAR) as it doens't throw an error for this. Will look further.

//edit

http://weekoldcheese.com/blog/?p=28

Looks like a solution.

Oh, boy, I read that Week Old Cheese blog but it's too late now to check it thoroughly. Just two things (probable problems) stuck out to me:

He was using Linux so most stuff won't work on my Windows PC (for example, pear config-get php_dir returns nothing but he said that might happen and I should look at that page which I didn't, yet).

He was able to install things, anything on his "live" server where I have no such possibility. It's "Take it as it is or die!" - it's a free service by an French ISP used by my recent client - an association without any money.

But I'll have a look whether xsltproc is installed on my "live" server - so maybe I can at least mimick the setup of it.

As for creating my own functions:
Apparently this problem is rare but not unique. And for now all they have to do is parse XML and tranform it with XSLT to HTML. And since both XML and XSLT contents is controlled by me it might work. Besides, I am afraid that both the Wrapper and SimpleXML with all surrounding stuff may not be up to transform XML with namespaces and attributes but I might be wrong about that.

I've set up a webpage at Google sites, so if eventually you want to take a look:
sites.google.com/site/xmlxslt4php/

Member Avatar for diafol

OK Al.

I am going to leave this thread unsolved until someone finds a way to install the XML-XSLT_Wrapper on a server run on Windows. For my functions I started the first thread for parsing XML without special XML functions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.