Link to home
Start Free TrialLog in
Avatar of qwertq
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...
Avatar of TeRReF
TeRReF
Flag of Netherlands image

Try this:
$xml = '<RESULT><ROW id="1">1</ROW><ROW id="2">2</ROW><ROW id="3">3</ROW></RESULT>';
$xml = domxml_open_mem($xml)
Avatar of qwertq
qwertq

ASKER

Fatal error: Call to undefined function: domxml_open_mem() in
ASKER CERTIFIED SOLUTION
Avatar of TeRReF
TeRReF
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of qwertq

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.
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.