Try the following modified version:
<?php
$xslData = '
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="article">
<table border="1" cellpadding="2" cellspacing="1">
<tr>
<td width="20%">
</td>
<td width="80%">
<h2><xsl:value-of select="title"/></h2>
<h3><xsl:value-of select="author"/></h3>
<br/>
<xsl:value-of select="body"/>
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>';
$xmlData = '<?xml version="1.0"?>
<article>
<title>Learning German</title>
<author>Sterling Hughes</author>
<body>
Essential phrases:
Komme sie mir sagen, woe die toilette es?
Eine grande beer bitte!
Noch einem bitte.
</body>
</article>';
if (xslt_process($xslData, $xmlData, $result))
{
echo "Here is the brilliant in-depth article on learning";
echo " German: ";
echo "<br>\n<br>";
echo nl2br($result);
}
else
{
echo "\tError number: " . xslt_errno() . "\n";
echo "\tError string: " . xslt_error() . "\n";
exit;
}
?>
-Sterling
> Here is the test data that I am using for the xslt_process() function.
> Also, as you will see at the end of this code if there is an error it calls
> the xslt_errno() and the xslt_error() functions and when I run this script I
> get this error:
>
> Error number: 2 Error string: OK
>
> Thanks,
> Jay
>
> <?php
> $xslData = '
> <xsl:stylesheet
> version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
> <xsl:template match="article">
> <table border="1" cellpadding="2" cellspacing="1">
> <tr>
> <td width="20%">
>
> </title>
> <td width="80%">
> <h2><xsl:value-of select="title"></h2>
> <h3><xsl:value-of select="author"></h3>
> <br>
>
> <xsl:value-of select="body">
> </td>
> </tr>
> </table>
> </xsl:template>
>
> </xsl:stylesheet>';
>
> $xmlData = '
> <?xml version="1.0"?>
> <article>
> <title>Learning German</title>
> <author>Sterling Hughes</author>
> <body>
> Essential phrases:
> <br>
> <br>
> Komme sie mir sagen, woe die toilette es?<br>
> Eine grande beer bitte!<br>
> Noch einem bitte.<br>
> </body>
> </article>';
>
> if (xslt_process($xslData, $xmlData, $result))
> {
> echo "Here is the brilliant in-depth article on learning";
> echo " German: ";
> echo "<br>\n<br>";
> echo $result;
> }
> else
> {
> echo "\tError number: " . xslt_errno() . "\n";
> echo "\tError string: " . xslt_error() . "\n";
> exit;
> }
> ?>
>
>
> On Mon, 11 Dec 2000, Sterling Hughes wrote:
>
> >
> > > Hello everyone--
> > > I'm trying to get sablotron to work with PHP4.0.3pl1 and in my phpinfo
> file
> > > it says that it is enabled. However, when I run a test script which
> calls
> > > the xslt_process() function it doesn't actually process the xsl file
> that I
> > > have it read. What it does is it returns the xsl file and when I print
> it
> > > out I get code such as this in the browser source:
> > >
> >
> > Could I perhaps see your php code, in the xslt_process() function you
> should
> > have the following syntax:
> >
> > bool xslt_process(string xsl_data, string xml_data, string &result)
> >
> >
> > where result will contain the results of the transformation.
> >
> > Regards,
> > Sterling
> >
>