hello.xml: <?xml version="1.0"?> <greeting> Hello, world! </greeting>
hello.xsl: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html"/>
<xsl:template match="/"> <xsl:apply-templates select="greeting"/> </xsl:template>
<xsl:template match="greeting"> <html> <body> <h1> <xsl:value-of select="."/> </h1> </body> </html> </xsl:template> </xsl:stylesheet>
My PHP code is in index.php: <?php
$proc = xslt_create(); $result = xslt_process($proc, "hello.xsl", "hello.xml"); xslt_free($proc);
echo $result;
?>
All three files are in the same directory. I'm running on Mac OS X using Marc Liyanage's precompiled PHP binary, which includes the XSLT extension. It seems to be running, since if I intentionally introduce a typo I get Sablotron errors written to the browser window. But otherwise the output is simply the original hello.xml's markup, with a character encoding added. I'm new to XSLT so I may be overlooking something simple. What am I doing wrong?
Thanks, --Dave
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php