📄 function.xslt-create.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Create a new XSLT processor</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div 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 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"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">resource</span> <span class="methodname"><b><b>xslt_create</b></b></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"> <h3 class="title">Return Values</h3> <p class="para"> Returns an XSLT processor link identifier on success, or <b><tt>FALSE</tt></b> on error. </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 <b>xslt_create()</b> example</b></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">"$path/$xsl"</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"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="function.xslt-free.html" class="function" rel="rdfs-seeAlso">xslt_free()</a></li> </ul> </p> </div></div><hr /><div 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 Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -