qwertq
asked on
XSLL Transformation on PHP4
I started with some advice from this question i found:
https://www.experts-exchange.com/questions/20272154/xsl-process.html?query=xsl&topics=103&showAll=true
Got it working fine with xml and xsl in outside files, but the problem is that my xml is not in a file, it is local memory.
Here is the code i am trying:
$xml = '<RESULT><ROW id="1">1</ROW><ROW id="2">2</ROW><ROW id="3">3</ROW></RESULT>';
$xh = xslt_create();
$args = array( "xmldata" => $xml);
xslt_process($xh, 'arg:/xmldata', 'test.xsl', $result, $args);
if ($result) {
print $result;
} else {
print " the \$result variable the reason is that " . xslt_error($xh) .
print " and the error code is " . xslt_errno($xh);
}
xslt_free($xh);
and this is the error i get:
"and the error code is 0 the $result variable the reason is that 1"
Thanks for the help...
https://www.experts-exchange.com/questions/20272154/xsl-process.html?query=xsl&topics=103&showAll=true
Got it working fine with xml and xsl in outside files, but the problem is that my xml is not in a file, it is local memory.
Here is the code i am trying:
$xml = '<RESULT><ROW id="1">1</ROW><ROW id="2">2</ROW><ROW id="3">3</ROW></RESULT>';
$xh = xslt_create();
$args = array( "xmldata" => $xml);
xslt_process($xh, 'arg:/xmldata', 'test.xsl', $result, $args);
if ($result) {
print $result;
} else {
print " the \$result variable the reason is that " . xslt_error($xh) .
print " and the error code is " . xslt_errno($xh);
}
xslt_free($xh);
and this is the error i get:
"and the error code is 0 the $result variable the reason is that 1"
Thanks for the help...
ASKER
Fatal error: Call to undefined function: domxml_open_mem() in
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks that worked....
what is that NULLed value for then? the post i linked above said it was result, so i was using it for that.
what is that NULLed value for then? the post i linked above said it was result, so i was using it for that.
It is the result, but it's a container, that's why the
if($result) didn't work.
If you use the NULL there, the function returns a string.
if($result) didn't work.
If you use the NULL there, the function returns a string.
$xml = '<RESULT><ROW id="1">1</ROW><ROW id="2">2</ROW><ROW id="3">3</ROW></RESULT>';
$xml = domxml_open_mem($xml)