Re: Re: DOM XML and php
| From: | Lucian COZMA | Date: | Thu, 11 Mar 2004 14:02:49 +0000 |
| Subject: | Re: Re: DOM XML and php | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-180140@lists.php.net to get a copy of this message | ||
It should look something like (pretty much extracted from manual):
<?php
// $xml and $xsl contain the XML and XSL data ($xsl =
file_get_contents('myxsl.xsl') and $xml
='<bla><bla1>lalala</bla1></bla>
$arguments = array(
'/_xml' => $xml,
'/_xsl' => $xsl
);
// Allocate a new XSLT processor
$xh = xslt_create();
// Process the document
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments);
if ($result) {
//SUCCESS, sample.xml was transformed by sample.xsl into the $result
print $result;
} else {
print "Sorry, sample.xml could not be transformed by sample.xsl into";
print " the \$result variable the reason is that " . xslt_error($xh) .
print " and the error code is " . xslt_errno($xh);
}
xslt_free($xh);
?>Lucian COZMA
"Lucian Cozma" <lcozma@interakt.ro> wrote in message
news:20040311135945.75800.qmail@pb1.pair.com...
> If you really want to use Sablotron (although I tried it I not liked it as
> much as DOMXML, gimme a sign, and I'll debug you.
>
> Regards,
> Lucian COZMA @ InterAKT
>
>
> "Tassos T" <nereus0@freemail.gr> wrote in message
> news:002701c4076d$c6f60c60$1900000a@TRITON...
> > Thanks for your reply but I have another problem
> >
> > I have an xml string if I use this code
> >
> > <?
> > header("Content-Type: text/xml");
> > echo $xml_string;
> > ?>
> > I can see the xml tree but I cannot transform with te xslt. Eg.
> > <?
> > $xp = xslt_create();
> > $result_xsl = xslt_process($xp, $xml_string, 'myxsl.xsl');
> > echo $result_xsl;
> > xslt_free($xp);
> >
> > ?>
> >
> > Please advise
> >
> > Regards
> >
> > tassos
> >
> > -----Original Message-----
> > From: Lucian COZMA [mailto:lcozma@interakt.ro]
> > Sent: Thursday, March 11, 2004 3:20 PM
> > To: php-general@lists.php.net
> > Subject: [PHP] Re: DOM XML and php
> >
> >
> > <?php
> > $xmlstr = '<bla><bla1>blabalabalab</bla1></bla>';
> > if(!$dom = domxml_open_mem($xmlstr)) {
> > echo "Error while parsing the document\n";
> > exit;
> > }
> > // The root domdocument node
> > $root = $dom->document_element();
> > ///Dump the content back to string
> > var_dump($dom->dump_mem());
> > ?>
> >
> > Read the manual in the DOM XML functions section.
> > Regards,
> > Lucian COZMA
> > "Tassos T" <nereus0@freemail.gr> wrote in message
> > news:002501c40764$b9243b60$1900000a@TRITON...
> > > Hello,
> > >
> > > I face a problem. I have a php script and I send a xml request to a
> > server.
> > > After I receive xml data but I have this data to an php string
> > > variable.
> > >
> > > How to create a xml dom with out to write a xml file ?
> > >
> > > I want to use a xslt to tranform that xml data.
> > >
> > >
> > > Any idea ?
> > >
> > > Thanks
> > >
> > > tassos
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>