Re: Xml-Xlst example dont work!

From: Date: Fri, 28 Jun 2002 14:45:45 +0000
Subject: Re: Xml-Xlst example dont work!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-104340@lists.php.net to get a copy of this message
Here's the code XML file: example.xml <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="example.xslt"?> <person> <name> <firstname>John</firstname> <middlename>Michael</middlename> <lastname>Stevens</lastname> </name> <email>jstevens@company.com</email> <phone> <home>999 999-9999</home> <cellular>888 888-8888</cellular> </phone> <department>Software Engineering</department> </person> XLST file: example.xslt <?xml version="1.0" encoding="UTF-8"?> <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:stylesheet version="1.0" mlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/person"> <html> <head> <title>XML and XSLT Example</title> </head> <body> <table> <tr> <td>Personal Information:</td> </tr> <tr> <td><xsl:value-of select="name/firstname" /></td> <td><xsl:value-of select="name/middlename" /></td> <td><xsl:value-of select="name/lastname" /></td> </tr> <tr> <td>Email Address:</td> <td><xsl:value-of select="email" /></td> </tr> <tr> <td><xsl:value-of select="department" /></td> </tr> </table> </body> </html> </xsl:template> </xsl:stylesheet> PHP file: example.php <?php $xsltproc = xslt_create(); $result = xslt_process( $xsltproc, 'example.xml', 'example.xslt' ); if( $result ) { echo "$result"; } else { die( sprintf( "The XSLT processor failed [%d]: %s", xslt_errno( $xsltproc ), xslt_error( $xsltproc ) ) ); } xslt_free( $xsltproc ); ?>

« previous php.general (#104340) next »