I'm new to XSLTProcessing in PHP and I have a very strange problem.
I am getting results back in XML format from a webservice. and when I load them into an XMLDoc and then try to transformToXML I get no results.
If I output the result I get from the webservice, copy and paste it into an XMLDoc and load that, the transformToXML works perfectly.
any idea what I am doing wrong?
and my XSL is
I am getting results back in XML format from a webservice. and when I load them into an XMLDoc and then try to transformToXML I get no results.
If I output the result I get from the webservice, copy and paste it into an XMLDoc and load that, the transformToXML works perfectly.
any idea what I am doing wrong?
Code:
$xmlDoc = new DOMDocument();
//$xmlDoc->load("properties.xml");
$xmlDoc->loadXML($xml);
$xsl = new DomDocument;
$xsl->load("property1.xsl");
$proc = new xsltprocessor;
$proc->importStyleSheet($xsl);
try {
$result = $proc->transformToXML($xmlDoc);
} catch (Exception $ex) {
throw new apException("Unable to transform XSL");
}
echo $result;
and my XSL is
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform">[/URL]
<xsl:template match="/">
<xsl:for-each select="newdataset/table">
<div class="redheader">
<a href="#">
<xsl:value-of select="displayaddress"/> - <xsl:value-of select="shortdescription"/>
</a>
</div>
<div class="subcontent">
<table border="0">
<tr>
<td rowspan="4">
<xsl:value-of select="imagelink"/>
</td>
<td> </td>
<td><strong>Address:</strong> <xsl:value-of select="addr1"/> </td>
</tr>
<tr>
<td> </td>
<td><strong>Reference Number:</strong><xsl:value-of select="pkid"/></td>
</tr>
<tr>
<td> </td>
<td><strong>Soverom:</strong> <xsl:value-of select="rooms"/></td>
</tr>
<tr>
<td> </td>
<td><strong><xsl:value-of select="description1"/></strong></td>
</tr>
</table>
</div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>