<!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>Returns an error string</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.xslt-errno.html">xslt_errno</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.xslt-free.html">xslt_free</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-error" class="refentry"> <div class="refnamediv"> <h1 class="refname">xslt_error</h1> <p class="verinfo">(PHP 4 >= 4.0.3)</p><p class="refpurpose"><span class="refname">xslt_error</span> — <span class="dc-title">Returns an error string</span></p> </div> <div class="refsect1 description" id="refsect1-function.xslt-error-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">string</span> <span class="methodname"><strong>xslt_error</strong></span> ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$xh</code></span> )</div> <p class="para rdfs-comment"> Returns a string describing the last error that occurred on the passed XSLT processor. </p> </div> <div class="refsect1 parameters" id="refsect1-function.xslt-error-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter"> xh</code></em></span><dd> <p class="para">The <acronym title="eXtensible Stylesheet Language Transformations">XSLT</acronym> processor link identifier, created with <span class="function"><a href="function.xslt-create.html" class="function">xslt_create()</a></span>.</p></dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.xslt-error-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns the error message, as a string. </p> </div> <div class="refsect1 examples" id="refsect1-function.xslt-error-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-5549"> <p><strong>Example #1 Handling errors using the <span class="function"><strong>xslt_error()</strong></span> and <span class="function"><a href="function.xslt-errno.html" class="function">xslt_errno()</a></span> functions. </strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /><br />$xh </span><span style="color: #007700">= </span><span style="color: #0000BB">xslt_create</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$result </span><span style="color: #007700">= </span><span style="color: #0000BB">xslt_process</span><span style="color: #007700">(</span><span style="color: #0000BB">$xh</span><span style="color: #007700">, </span><span style="color: #DD0000">'dog.xml'</span><span style="color: #007700">, </span><span style="color: #DD0000">'pets.xsl'</span><span style="color: #007700">);<br />if (!</span><span style="color: #0000BB">$result</span><span style="color: #007700">) {<br /> die(</span><span style="color: #0000BB">sprintf</span><span style="color: #007700">(</span><span style="color: #DD0000">"Cannot process XSLT document [%d]: %s"</span><span style="color: #007700">,<br /> </span><span style="color: #0000BB">xslt_errno</span><span style="color: #007700">(</span><span style="color: #0000BB">$xh</span><span style="color: #007700">), </span><span style="color: #0000BB">xslt_error</span><span style="color: #007700">(</span><span style="color: #0000BB">$xh</span><span style="color: #007700">)));<br />}<br /><br />echo </span><span style="color: #0000BB">$result</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">xslt_free</span><span style="color: #007700">(</span><span style="color: #0000BB">$xh</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-function.xslt-error-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.xslt-errno.html" class="function" rel="rdfs-seeAlso">xslt_errno()</a> - Returns an error number</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-errno.html">xslt_errno</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.xslt-free.html">xslt_free</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>