note 36023 deleted from function.domxml-xslt-stylesheet by didou

From: Date: Fri, 17 Jun 2005 23:47:33 +0000
Subject: note 36023 deleted from function.domxml-xslt-stylesheet by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-90611@lists.php.net to get a copy of this message
Note Submitter: domxml_xslt_stylesheet_file ---- You can also do it like this: sample.php ---------------- <?php //Transformer XML -> HTML par XSL $CurrentDir = dirname(__FILE__); $xmldoc = domxml_open_file("$CurrentDir\\sample.xml"); $xsldoc = domxml_xslt_stylesheet_file("$CurrentDir\\sample.xsl"); $result = $xsldoc->process($xmldoc); print $xsldoc->result_dump_mem($result); ?> sample.xml --------------- <?xml version="1.0" encoding="ISO-8859-1"?> <catalog> <cd> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> </cd> <cd> <title>Hide your heart</title> <artist>Bonnie Tyler</artist> <country>UK</country> <company>CBS Records</company> <price>9.90</price> <year>1988</year> </cd> <autor> <name>Autor Name</name> <adress>Adress</adress> <postal>postalcode</postal> <city>City</city> </autor> </catalog> sample.xsl ------------------- <?xml version="1.0" encoding="ISO-8859-1"?> <!-- Edited with XML Spy v4.2 --> <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="0"> <tr bgcolor="#9acd32"> <th align="left">Title</th> <th align="left">Artist</th> <th align="left">Price</th> </tr> <xsl:for-each select="catalog/cd"> <tr> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="artist"/></td> <td><xsl:value-of select="price"/></td> </tr> </xsl:for-each> </table> <br/> <br/> <br/> <br/> <table border="0"> <xsl:for-each select="catalog/autor"> <tr> <th align="left">Autor of site</th> </tr> <tr> <td><xsl:value-of select="name"/></td> </tr> <tr> <td><xsl:value-of select="adress"/></td> </tr> <tr> <td><xsl:value-of select="postal"/></td> </tr> <tr> <td><xsl:value-of select="city"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>

« previous php.notes (#90611) next »