AlainCouthures / xsltforms

XForms to XHTML+Javascript (AJAX) conversion based on a unique XSL transformation. Suitable server-side (PHP) or client-side (Google Chrome, Edge, Internet Explorer, Mozilla FireFox, Opera, Safari) browser treatment where an XSLT 1.0 engine is available
37 stars 19 forks source link

How to use it in PHP? #3

Closed rysi3k closed 9 years ago

rysi3k commented 9 years ago

Hello @AlainCouthures I haven't found nowhere how to use XSLTForms in PHP, how to parse it and display in browser? Thanks for help.

Greetings

AlainCouthures commented 9 years ago

Hello, There is no specific way to apply XSLTForms stylesheet at server-side with PHP. Please have a look at this simple example:

    $xml = new DOMDocument();
    $xml->load($_GET["form"]);
    $xsl = new DOMDocument();
    $xsl->load("xsltforms/xsltforms.xsl");
    $xslp = new xsltProcessor();
    $xslp->importStyleSheet($xsl);
    $result = $xslp->transformToXml($xml);
    header("Content-Type: text/html");
    echo $result;

Thank you for your feedback!

rysi3k commented 9 years ago

Hi, thanks for help - works like a charm!