简体   繁体   中英

PHP with XSL & XML

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 ??

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM