<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Create a new XSLT processor</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.xslt-backend-version.html">xslt_backend_version</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.xslt-errno.html">xslt_errno</a></div> <div class="up"><a href="ref.xslt.html">XSLT (PHP 4) Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.xslt-create" class="refentry"> <div class="refnamediv"> <h1 class="refname">xslt_create</h1> <p class="verinfo">(PHP 4 >= 4.0.3)</p><p class="refpurpose"><span class="refname">xslt_create</span> — <span class="dc-title">Create a new XSLT processor</span></p> </div> <div class="refsect1 description" id="refsect1-function.xslt-create-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">resource</span> <span class="methodname"><strong>xslt_create</strong></span> ( <span class="methodparam">void</span> )</div> <p class="para rdfs-comment"> Create and return a new XSLT processor resource for manipulation by the other XSLT functions. </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.xslt-create-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns an <acronym title="eXtensible Stylesheet Language Transformations">XSLT</acronym> processor link identifier on success, or <strong><code>FALSE</code></strong> on error. </p> </div> <div class="refsect1 examples" id="refsect1-function.xslt-create-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-5548"> <p><strong>Example #1 <span class="function"><strong>xslt_create()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">xml2html</span><span style="color: #007700">(</span><span style="color: #0000BB">$xmldata</span><span style="color: #007700">, </span><span style="color: #0000BB">$xsl</span><span style="color: #007700">)<br />{<br /> </span><span style="color: #FF8000">/* $xmldata -> your XML */<br /> /* $xsl -> XSLT file */<br /><br /> </span><span style="color: #0000BB">$path </span><span style="color: #007700">= </span><span style="color: #DD0000">'include'</span><span style="color: #007700">;<br /> </span><span style="color: #0000BB">$arguments </span><span style="color: #007700">= array(</span><span style="color: #DD0000">'/_xml' </span><span style="color: #007700">=> </span><span style="color: #0000BB">$xmldata</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">$xsltproc </span><span style="color: #007700">= </span><span style="color: #0000BB">xslt_create</span><span style="color: #007700">();<br /> </span><span style="color: #0000BB">xslt_set_encoding</span><span style="color: #007700">(</span><span style="color: #0000BB">$xsltproc</span><span style="color: #007700">, </span><span style="color: #DD0000">'ISO-8859-1'</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">$html </span><span style="color: #007700">=<br /> </span><span style="color: #0000BB">xslt_process</span><span style="color: #007700">(</span><span style="color: #0000BB">$xsltproc</span><span style="color: #007700">, </span><span style="color: #DD0000">'arg:/_xml'</span><span style="color: #007700">, </span><span style="color: #DD0000">"</span><span style="color: #0000BB">$path</span><span style="color: #DD0000">/</span><span style="color: #0000BB">$xsl</span><span style="color: #DD0000">"</span><span style="color: #007700">, </span><span style="color: #0000BB">NULL</span><span style="color: #007700">, </span><span style="color: #0000BB">$arguments</span><span style="color: #007700">);<br /><br /> if (empty(</span><span style="color: #0000BB">$html</span><span style="color: #007700">)) {<br /> die(</span><span style="color: #DD0000">'XSLT processing error: '</span><span style="color: #007700">. </span><span style="color: #0000BB">xslt_error</span><span style="color: #007700">(</span><span style="color: #0000BB">$xsltproc</span><span style="color: #007700">));<br /> }<br /> </span><span style="color: #0000BB">xslt_free</span><span style="color: #007700">(</span><span style="color: #0000BB">$xsltproc</span><span style="color: #007700">);<br /> return </span><span style="color: #0000BB">$html</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-function.xslt-create-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.xslt-free.html" class="function" rel="rdfs-seeAlso">xslt_free()</a> - Free XSLT processor</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.xslt-backend-version.html">xslt_backend_version</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.xslt-errno.html">xslt_errno</a></div> <div class="up"><a href="ref.xslt.html">XSLT (PHP 4) Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>