Hi, i am looking to pass a variable from a php page into an xsl stylesheet
i have found some code but it does not seem to work.
stylesheet:
<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0"
xmlns:xsl="<xsl
utput method="html"/>
<xsl:template match="/">
<html>
<head><title>test</title></head>
<body>
<h2>Activity</h2>
<xsl
aram name="myvar"/>
<xsl:for-each select ="Lom/general">
<h3> Activity Name: <p><B> <xsl:value-of select="title"/></B></p></h3>
<p>Description:</p><p><xsl:value-of select="description"/></p>
</xsl:for-each>
<xsl:for-each select="Lom/technical">
<p>Activity format: <xsl:value-of select="format"/></p>
</xsl:for-each>
<xsl:for-each select="Lom/technical/location">
<a href="{@link}">
<p>Click to access</p>
</a>
</xsl:for-each>
My PHP variable : <h3><xsl:value-of select="$myvar"/></h3><br />
</body>
</html>
</xsl:template></xsl:stylesheet>
php page
<?php
// Gonna contain PHP-XML output
$xh = xslt_create();
$p_id = 'cia01';
// Read plain PHP-XML output
//$xmlData = file_get_contents (' "r");
$c = curl_init('curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$xml = curl_exec($c);
// Stack up output into one String
//while ($line = fgets ($xmlData))
//$xml .= $line;
//print $xml;
$arguments = array(
'/_xml' => $xml,
);
$parameters = array (
'myvar' => 'test'
);
// Process the document
$result = xslt_process($xh, 'arg:/_xml', 'xml2.xsl', NULL, $arguments, $parameters);
// Print out your transformed document
echo $result;
xslt_free($xh);
?>
would appreciate any ideas or help
thanks in advance
alex
i have found some code but it does not seem to work.
stylesheet:
<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0"
xmlns:xsl="<xsl
<xsl:template match="/">
<html>
<head><title>test</title></head>
<body>
<h2>Activity</h2>
<xsl
<xsl:for-each select ="Lom/general">
<h3> Activity Name: <p><B> <xsl:value-of select="title"/></B></p></h3>
<p>Description:</p><p><xsl:value-of select="description"/></p>
</xsl:for-each>
<xsl:for-each select="Lom/technical">
<p>Activity format: <xsl:value-of select="format"/></p>
</xsl:for-each>
<xsl:for-each select="Lom/technical/location">
<a href="{@link}">
<p>Click to access</p>
</a>
</xsl:for-each>
My PHP variable : <h3><xsl:value-of select="$myvar"/></h3><br />
</body>
</html>
</xsl:template></xsl:stylesheet>
php page
<?php
// Gonna contain PHP-XML output
$xh = xslt_create();
$p_id = 'cia01';
// Read plain PHP-XML output
//$xmlData = file_get_contents (' "r");
$c = curl_init('curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$xml = curl_exec($c);
// Stack up output into one String
//while ($line = fgets ($xmlData))
//$xml .= $line;
//print $xml;
$arguments = array(
'/_xml' => $xml,
);
$parameters = array (
'myvar' => 'test'
);
// Process the document
$result = xslt_process($xh, 'arg:/_xml', 'xml2.xsl', NULL, $arguments, $parameters);
// Print out your transformed document
echo $result;
xslt_free($xh);
?>
would appreciate any ideas or help
thanks in advance
alex