Tobias Reif wrote:
> xslt_run ($processor, $xsl_file, $xml_file,
> $xslt_params);
That should be:
xslt_run ($processor, $xsl_file, $xml_file, "arg:/_result",
$xslt_params);
Here is some code for you to test. I used Matthew Peltzer's
guestbook.xml and guestbook.xsl to test these functions
(see Matthew Peltzer's email on this thread). Here is the
code and the modified guestbook.xsl, if you are interested:
guestbook.php:
<?php
$xml_file = "guestbook.xml";
$xsl_file = "guestbook.xsl";
$xslt_params["chosen_first_name"] = $HTTP_GET_VARS["chosen_first_name"];
$xslt_params["chosen_last_name"] = $HTTP_GET_VARS["chosen_last_name"];
$processor = xslt_create();
xslt_run ($processor, $xsl_file, $xml_file, "arg:/_result",
$xslt_params);
$result = xslt_fetch_result ($processor);
xslt_free ($processor);
echo $result;
?>
Usage:
http://yourdomain.com/guestbook.php?chosen_first_name=John&chosen_last_name=Smith
modified guestbook.xsl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:param name="chosen_first_name">0</xsl:param>
<xsl:param name="chosen_last_name">0</xsl:param>
<xsl:template match="/">
<p><xsl:value-of select="$chosen_first_name"/></p>
<p><xsl:value-of select="$chosen_last_name"/></p>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="guestbook">
<xsl:for-each select="entry">
<p class="section">
[<xsl:value-of select="date"/> @ <xsl:value-of select="time"/>]
</p><br/>
<p class="content">
<xsl:value-of select="text"/> - [<xsl:value-of select="author"/>]
</p>
</xsl:for-each>
<xsl:apply-templates />
</xsl:template>
</xsl:stylesheet>
Antti