Tobias Reif wrote:
> Peter,
> > ok, guess i have to solve my own problems here ;)
> maybe you could solve mine too? 8)
Can I try? :)
> With the following code, I run all-bup.xml through
> contacts.xslt using sablotron as PHP-module; this
> works.
> No I want to pass values for variables from an
> HTML-form to the XSLT.
> Would I replace the line
> xslt_process($xsl_content, $xml_content, $xsl_tfmtion);
> with
> XSLT_RUN()
> ?
I'm using apache 1.3.14 with php4.0.4 and sablotron .51
under Linux.
I did get both xslt_run() and xslt_transform() functions
to work. Here is the code :
<?php
$xml_file = "all-bup.xml";
$xsl_file = "contacts.xslt";
// Web server has to have a permission to create or write to this file.
// Otherwise there will be a "msgtype: error"
$result_file = "result.html";
$xslt_params["chosen_first_name"] = $HTTP_GET_VARS["chosen_first_name"];
$xslt_params["chosen_last_name"] = $HTTP_GET_VARS["chosen_last_name"];
// This works
xslt_transform ($xsl_file, $xml_file, $result_file, $xslt_params);
readfile ($result_file);
// This also works
$processor = xslt_create();
xslt_run ($processor, $xsl_file, $xml_file, $result_file, $xslt_params);
xslt_free ($processor);
readfile ($result_file);
?>
The code doesn't work with concurrent users. So you have
to create a different result filename every time.
Put into the XSL file (something like this):
<xsl:param name="chosen_first_name">0</xsl:param>
<xsl:param name="chosen_last_name">0</xsl:param>
And you can get the value like this:
<xsl:value-of select="$chosen_first_name"/>
Regards,
Antti Huotari