Hi again,
net.php
<?php
include('xml2.php');
include('xsl.php');
// $xml and $xsl contain the XML and XSL data
//$xsl = readfile('net.xsl');
$arguments = array('/_xml' => $xml, '/_xsl' => $xsl);
// Allocate a new XSLT processor
$xh = xslt_create();
// Process the document
$xmlresult = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments);
if ($xmlresult) {
echo $xmlresult;
} else {
echo " Error " . xslt_error($xh);
echo " and the error code is " . xslt_errno($xh);
}
xslt_free($xh);
?>
xsl.php
<?php
header('Content-Type: text/xml');
$xsl ='<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">';
$xsl .='<xsl:output method="html"/>';
$xsl .='<xsl:template match="stories">';
$xsl .='<html>';
$xsl .='<body>';
$xsl .='<h2>My CD Collection</h2>';
$xsl .='<table border="1">';
$xsl .='<tr bgcolor="#9acd32">';
$xsl .='<th align="left">Headline</th>';
$xsl .='<th align="left">Journalist</th>';
$xsl .='</tr>';
$xsl .='<xsl:for-each select="story">';
$xsl .='<tr>';
$xsl .='<td><xsl:value-of select="headline"/></td>';
$xsl .='<td><xsl:value-of select="journalist"/></td>';
$xsl .='</tr>';
$xsl .='</xsl:for-each>';
$xsl .='</table>';
$xsl .='</body>';
$xsl .='</html>';
$xsl .='</xsl:template>';
$xsl .='</xsl:stylesheet>';
?>
xml2.php
<?php
header('Content-Type: text/xml');
$xml = '<stories>';
$xml .= '<story>';
$xml .= '<category>1</category>';
$xml .= '<headline>Headline dave</headline>';
$xml .= '<para1>para1 dave</para1>';
$xml .= '<para2>para2 2 2 2</para2>';
$xml .= '<body>body body blah</body>';
$xml .= '<journalist>Elliott Clark</journalist>';
$xml .= '<jpgurl>pic</jpgurl>';
$xml .= '<wbmpurl>pic2</wbmpurl>';
$xml .= '<photographer>picc</photographer>';
$xml .= '<date>date</date>';
$xml .= '</story>';
$xml .= '</stories>';
?>
I think its the functions on the server. I tried the one where i have my sites hosted and they give the, "call to undefined function....." etc etc
So i tried it on the uni server where we are meant to submit our work to, and got the same error, haha, seems they havent fully catered for php users. Its all ASP and CFM there.
However at 4am this morning i managed to make it work a very simple way, but not the way i wanted it to.
I just output my xml to a file, instead of a variable, and that just called its own xsl file. Bit basic, but it does work.