kelvin, here is the example: catalog.php <?php $doc = new DOMDocument(); $xsl = new XSLTProcessor(); $doc->load('catalog.xsl'); $xsl->importStyleSheet($doc); $doc->load('catalog.xml'); echo $xsl->transformToXML($doc); ?> catalog.xml <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="catalog.xsl"?> <catalog> <cd> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> </cd> </catalog> catalog.xsl <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th align="left">Title</th> <th align="left">Artist</th> </tr> <xsl:for-each select="catalog/cd"> <tr> <td><xsl:value-of select="title" /></td> <td><xsl:value-of select="artist" /></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> in this example the xml data is imported from a file rather than built in memory. also, i would like to mention that most browsers, ie, firefox and opera namely can render the xhtml themselves given the xml and xsl files which is something you may want to consider. -nathan On 7/6/07, Kelvin Park <kelvinpark86@xxxxxxxxx> wrote:
Is it possible to have PHP code completely separate from the HTML page that needs to be completely dynamic? (That's how ASP.NET sort of works I think). If this is possible, HTML CODE, PHP CODE, AND THE CSS CODE can be completely separate, increasing the clarity of all the source code. My second question is: Is it more efficient to always code OOP PHP then just simple functions here and there?