0

I have two files student.xml & sytle_student.xsl and one file PHP whaich contain form that search for data in the xml file but the result dosen't appear in the style attached in the xsl file i used this function

               $xslDoc = new DOMDocument();
               $xslDoc->load("style_student.xsl");
               $xmlDoc = new DOMDocument();
               $xmlDoc->load("student.xml");
               $proc = new XSLProcessor();
               $proc->importStylesheet($xslDoc);
                    echo $proc->transformToXML($xmlDoc);

but it generate 2 errors in this line

               $proc = new XSLProcessor();

The error : Class 'XSLProcessor' not found in C:\wamp\www\index.php on line 51

how can i handle this error to display ya result with the xsl style ??

3
  • 1
    Did you mean XSLTProcessor? If so, you're just missing a "T". Commented Nov 30, 2013 at 11:19
  • it will generate the same error i edidted xslt to xsl because the xsl file is .xsl not .xslt but still thesame problem Commented Nov 30, 2013 at 11:30
  • 1
    The name of the class has nothing to do with the name of the file. Change your code to use XSLTProcessor and post the exact error you get using that. Also, which version of PHP are you using? (You can find detailed information about your PHP installation by using the function phpinfo(); in your php file.) Commented Nov 30, 2013 at 11:31

1 Answer 1

3

The class is called XSLTProcessor, the extension is ext/xsl.

Check if the extension ext/xsl is loaded.

var_dump(extension_loaded('xsl'));

If not install the extension and/or change the php.ini to activate it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.