what are the new functions .. since XSLT funcs have been removed from PHP 5 ???
any DOCS available ?
any help would be appreciated ..
Bye
Armando
| SitePoint Sponsor |
what are the new functions .. since XSLT funcs have been removed from PHP 5 ???
any DOCS available ?
any help would be appreciated ..
Bye
Armando
xslt functions REMOVED from php5? Ikes.. i thought they were going to be replacing it, not removing it...
they couldn't they wouldn't... unless theres a better solution?

really quick transformation example:PHP Code:importStylesheet()
transformToDoc()
transformToUri()
transformToXml()
setParameter()
getParameter()
removeParameter()
PHP Code:$xmlDoc = new DomDocument();
$xmlDoc->load('foo.xml');
$xslt = new XsltProcessor();
$xslt->importStylesheet('bar.xml');
// I have no idea what the first parameter is for. And I haven't really bothered to investigate... but passing NULL is fine.
$xslt->setParameter(NULL, (string) $name, (string) $value);
$transformation = $xslt->transformToXml($xmlDoc); // returns string
echo $transformation;
// or
$transformation = $xslt->transformToDoc($xmlDoc); // returns DomDocument object
echo $transformation->saveXml();
Always open to question or ridicule

(For anyone interested) The first parameter specifies the Namespace - but it's not used yet.Originally Posted by sleepeasy
Last edited by sleepeasy; Dec 4, 2003 at 12:44.
Always open to question or ridicule
So, anyway, what happens with XSLT support in PHP5? I have an enterprise app that is completely built arround XSLT using Sablotron. My scripts generate XML, call the relevant XSL files and rander HTML through XSLT.
How does that change in PHP5?

For what you want to do just use the functions i mentioned in one of the posts in this thread.
What's cool about XML in PHP5:
- W3C Compliant
- EXSLT support*
- Call any PHP function from within your XSLT stylesheets*
- XSLT is very fast (in my experience)
- Support for streams
- XInclude
- XSchema, RelaxNG and DTD validation
- Extensible classes
- Exceptions
- Full XML Namespace support
- SimpleXML
- SimpleXML <-> DOM Interoperability
- XPath
* Only in CVS to my knowledge
Basically XML in PHP5 is great.
Always open to question or ridicule
If you're using Sablotron now, then in PHP5 your app will be much faster when coded to work with the PHP5 XSLT functions as Sablotron is slow compared to the new functions - in fact it's slow compared to the existing DOM XSLT functions in PHP4.
Karl Austin :: Profile :: KDA Web Services Ltd.
Business Web Hosting :: Managed Dedicated Hosting :: From £250/m
Personal Web Hosting :: Budget Web Hosting :: From £50/y
Call 0800 542 9764 today and ask about our Cloud Hosting Platform
That's a relief. Sablotron seems to add quite a lot to the processing times. If I just run the script that generates the XML, without calling the XSLT functions from Sablotron, I get like 0.03 seconds processing on a page with 10+ queries (running on a Dual Xeon 3.06 Server with 4 gigs of RAM).... turn XSL processing on, and it goes to 0.3 seconds. Quite a difference eh?
The dude that invented Object Orientation should have won a Nobel.
I get a Fatal error: Class 'XsltProcessor' not found,
I'm assuming this is because I havn't loaded the XSL functionality. Can you run through a windows/linux php5 xsl installation?
For windows users, simple drop php_xsl.dll into your windows system directory and uncomment the line in php.ini.
However, I found the code to replicate the above mentioned to be as follows:
<?
$xml = new DomDocument;
$xml->load('article.xml');
$xsl = new DomDocument;
$xsl->load('article.xsl');
$xslt = new XsltProcessor;
$xslt->importStylesheet($xsl);
$transformation = $xslt->transformToXml($xml);
echo $transformation;
?>
I get the same error but under Linux.
Any usefull comment would be great!!!
Originally Posted by aidan





Yet to look at PHP5 myself, though I'm reading with interest, sorry can't help you though![]()
Off course, It was my mistake, I had forgotten to install libxslt![]()
It works!!




Is there a way of doing XsltProcessor without resorting to installing php5+ or getting salbotron or whatever. I ask because most hosts haven't moved to php5 yet so I cannot get the XsltProcessor to work unless I use php4+.
If possible, does anybody know how to get the XsltProcessor thing to work without installing third-party software on php4+?
Many thanks.





Hi...
I've personally had a real nightmare trying to get libxml2 installed to a sufficient level to keep PHP5 happy (under Mandrake). Seems there are all sorts of unlisted dependencies in the later versions of the libxml RPMs. In particular you need zlib1 of a pretty recent version and libm.so.6 (part of the core) and devel versions to boot.
I gave up with the dependency hell until someone builds a PHP5 RPM.
yours, Marcus
Marcus Baker
Testing: SimpleTest, Cgreen, Fakemail
Other: Phemto dependency injector
Books: PHP in Action, 97 things




Ah screw it then, I don't understand why they made PHP5 so hard to install and use. If it's not one thing (moving dll's, changing lots of stuff in the ini's) it's another (for example it says in the installation readme to point the extension directory to the folder called extension, except there was never any folder called extension provided).
Just had a quick look on this thread, so I don't know if it was already mentioned, but having a quick glance at the PHP manual reveals
(from http://www.php.net/manual/en/ref.xslt.php)Note: This extension has been removed as of PHP 5 and moved to the PECL repository.
Note: If you need xslt support with PHP 5 you can use the XSL extension.
The documentation for the XSL stuff in PHP 5 is at http://www.php.net/manual/en/ref.xsl.php
From that page:
So it should work out-of-the-boxPHP 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.
BTW, I use the Debian packages from dotdeb.org and they work like a charm -- no apache2 support though![]()
remember my name - you'll scream it later
In a debian, it was a simple "apt-get install libxml2"Originally Posted by lastcraft
but afaik, mandrake's urpmi should do the job too, but I haven't dabbled much in rpm based distros for a year or so.
I was playing with the new xsl stuff on windows, looks pretty cool. Ill attatch a zip if you want to see my examples (nothing spectacular).
Originally Posted by Dangermouse
Actually, I'll post a link to my resume tonight... I made an xhtml/css version, which I'm going to play transforming my HR-XML version of it to the xhtml version.
Gotta impress prospective employers![]()
I didn't have any big problems installning libxml2 och libxslt1 on my Debian 3.0r2 platform. No wierd dependencies, etc.
I used PHP's XSL extenstion to transform my XML resume to xhtml.
Feel free to look at it
http://www.bluefuzion.com/resume/resume.php
http://www.bluefuzion.com/resume/resume.phps
http://www.bluefuzion.com/resume/resume.xml
http://www.bluefuzion.com/resume/resume.xsl
guys
i could not find php_xsl.dll anywhere on my system
could anyone tell me where do i find it
Have had no real problems with the gnu/linux ubuntu PHP5 32/64 packages
http://archive.ubuntu.com/ubuntu/pool/main/p/php5/


The only issue i discovered with xsl instead of xslt is that the basepath used for <xsl:include etc can't be set anymore.. this may mean you need to use either a filepath (this way, the path is set right) instead of a string with the xsl in or rewrite the xsl so that all locations in <xsl:include are modified...
Bookmarks