Re: Re: xsl + xml
| From: | José Manuel Peso | Date: | Wed, 04 Oct 2006 14:08:52 +0000 |
| Subject: | Re: Re: xsl + xml | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-242606@lists.php.net to get a copy of this message | ||
Colin Guthrie escribió:
José Manuel Peso Echarri wrote:There is in DOM form(compile --with-dom-xslt and libxslt):Hi people, I am looking for a library that mix xsl and xml producing output in xhtml at server side. I have readed about sablotron and libxsl, but i am confused. Which is the best alternative in perfomance terms for the versions 4.2, 4.3? is there some way for preprocess xsl or let ir in memory or any way for improve the resources usage?Dunno about v4, but for v5 at least: $xsl = DOMDocument::loadXML($xslt_as_a_string); $xsltproc = new XSLTProcessor; $xsltproc->importStyleSheet($xsl); echo $xsltproc->transformToXML($my_xml_dom_doc); If anybody is interested in the code:
$xslDom = domxml_xslt_stylesheet_file($this->xsl);
$params = array();
$result = $this->xslDom->process($xml, $params);
$this->assertEquals($this->html,$result->dumpmem());
There is in Sablotron form( compiling with --enable-xslt and sablotron ext):
$arguments = array('/_xml' => file_get_contents($this->xml),
'/_xsl' => file_get_contents($this->xsl)); $xh = xslt_create(); $result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL,arguments); xslt_free($xh);
Of course, all in PHP4
I had tested this two API for processing XSL, but now my question is about the improvement of resources usage.
I want to use eaccelerator extension for caching the xsl_stylessheet objects and give the xmls continuosly for getting xhtml. It not works correctly, because the xsl object contains a handler (that is not serializable).
Any way for caching in memory xsl objects ?
Regards,
Jose
Or something like that..... going form memory, so there may be more appropriate commands etc. Col.