Transforming XML with XSLT and PHP - Transforming the Document
(Page 4 of 5 )
Using the XSLT Parser is simple and straight forward. The parser is created, the XML document and XSLT stylesheet is passed to it and the transformed document is returned.
<?php $parser = xslt_create(); $html = xslt_process($parser, "exampleDocument.xml", "exampleTemplate.xsl"); xslt_free($parser);
echo $html; ?> |
.First, an XSLT parser object is created to transform the XML document using the function xslt_create which returns a handle to the parser. The xslt_process function accepts the parser handle, the XML document and the XSLT document. It applies the template rules and returns the transformed version of the XML document. Finally, the system resources used for the parser are destroyed by using the xslt_free function.
Next: Conclusion >>
More Miscellaneous Articles
More By bluephoenix