Hi All,
This post is for those who are getting the above error when the are trying to use XSLT with PHP5.
I was knocking my head against this problem for a while but today I finally cracked it.
Context:
Debian( Upgraded php from 4 to 5 and the xslt problem starting happening.
I was using the following to test the XSL installation:
test.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<members>
<member>
<firstName>Jim</firstName>
<lastName>Rockerberry</lastName>
<score>34</score>
</member>
<member>
<firstName>Sally</firstName>
<lastName>Miller</lastName>
<score>12</score>
</member>
<member>
<firstName>Hank</firstName>
<lastName>Jamestown</lastName>
<score>44</score>
</member>
</members>
test.xsl
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="members">
Test of XML/XSLT parsing:
<ul>
<xsl:for-each select="member">
<li><xsl:value-of select="firstName"/> <xsl:value-of select="lastName"/>, score = <xsl:value-of select="score"/></li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
test.php
<?
$xml = new DomDocument;
$xml->load('test.xml');
$xsl = new DomDocument;
$xsl->load('test.xsl');
$xslt = new Xsltprocessor;
$xslt->importStylesheet($xsl);
$transformation = $xslt->transformToXml($xml);
echo $transformation;
?>
running test.php in my browser gave this error
Fatal error: Class 'xsltProcessor' not found
Resolution:
install php5-xsl by running
apt-get install php5-xsl
This package can be obtained for most linux distributions. Just search google for php5-xsl and your linux distribution.
I hope this helps somebody!Dontcha just love Debian
You might want to edit your post, since php-xsl is for PHP 4.rm
This post is for those who are getting the above error when the are trying to use XSLT with PHP5.
I was knocking my head against this problem for a while but today I finally cracked it.
Context:
Debian( Upgraded php from 4 to 5 and the xslt problem starting happening.
I was using the following to test the XSL installation:
test.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<members>
<member>
<firstName>Jim</firstName>
<lastName>Rockerberry</lastName>
<score>34</score>
</member>
<member>
<firstName>Sally</firstName>
<lastName>Miller</lastName>
<score>12</score>
</member>
<member>
<firstName>Hank</firstName>
<lastName>Jamestown</lastName>
<score>44</score>
</member>
</members>
test.xsl
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="members">
Test of XML/XSLT parsing:
<ul>
<xsl:for-each select="member">
<li><xsl:value-of select="firstName"/> <xsl:value-of select="lastName"/>, score = <xsl:value-of select="score"/></li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
test.php
<?
$xml = new DomDocument;
$xml->load('test.xml');
$xsl = new DomDocument;
$xsl->load('test.xsl');
$xslt = new Xsltprocessor;
$xslt->importStylesheet($xsl);
$transformation = $xslt->transformToXml($xml);
echo $transformation;
?>
running test.php in my browser gave this error
Fatal error: Class 'xsltProcessor' not found
Resolution:
install php5-xsl by running
apt-get install php5-xsl
This package can be obtained for most linux distributions. Just search google for php5-xsl and your linux distribution.
I hope this helps somebody!Dontcha just love Debian
You might want to edit your post, since php-xsl is for PHP 4.rm