Transforming
an XML document using XSL using PHP is very easy if you are using the
document object model available in PHP. The steps involved in transforming
an XML document are the same as you do with other programming languages
like ASP and ASP.Net.
_______________________________________________
_______________________________________________
You
will be creating two new document objects. One is for loading the XML
document and the other is for loading the XSL document. Then create
an instance of the XSLT processor and register the PHP functions using
the registerPHPFunctions() method.
Now use
the import stylesheet method of the XSLT processor instance to import
the XSL style sheet that was earlier loaded in the DOM. After this step
use the transformToDoc method of the XSLT processor to transform the
XML document.
The transformToDoc
method takes the XML document object as its argument. Now print the
resulting transformation. This method is an easy way to transform an
XML document using XSL in PHP. Lots of examples on this are available
online.