Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

XSLL Transformation on PHP4

Posted on 2006-07-23
5
Medium Priority
?
302 Views
Last Modified: 2006-11-18
I started with some advice from this question i found:
http://www.experts-exchange.com/Web/Web_Languages/PHP/Q_20272154.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...
0
Comment
Question by:qwertq
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 29

Expert Comment

by:TeRReF
ID: 17164040
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)
0
 

Author Comment

by:qwertq
ID: 17164044
Fatal error: Call to undefined function: domxml_open_mem() in
0
 
LVL 29

Accepted Solution

by:
TeRReF earned 600 total points
ID: 17164064
Try to change this line:
xslt_process($xh, 'arg:/xmldata', 'test.xsl', $result, $args);
to
$result = xslt_process($xh, 'arg:/xmldata', 'test.xsl', NULL, $args);
0
 

Author Comment

by:qwertq
ID: 17164068
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.
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 17164125
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.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question