I am working on developing a Travel website which uses XML API\'s to get the data.
However i am relatively new to XML and outputting it. I have been experimenting wi
XSLT works like a charm and is supported by PHP. It takes this XSLT script to output your XML file:
Test
User:
Line ID:
-
To run the script against your file use just 3 lines of PHP code:
importStylesheet(DOMDocument::load("test.xsl")); //load script
echo $proc->transformToXML(DOMDocument::load("test.xml")); //load your file
?>
You can even try this transformation in your browser without any PHP adding this
as second line in your XML file and opening the XML file in Firefox or IE having the XSL file in the same folder.
Changing the 3rd PHP line in this
$proc->transformToUri(DOMDocument::load("test.xml"),"test.html");
will save the output as static file.
Some good advice is suggested here:
https://stackoverflow.com/questions/339930/any-good-xslt-tutorial-book-blog-site-online