<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.xsltprocessor.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'xsltprocessor.setparameter.php',
    1 => 'XSLTProcessor::setParameter',
    2 => 'Set value for a parameter',
  ),
  'up' => 
  array (
    0 => 'class.xsltprocessor.php',
    1 => 'XSLTProcessor',
  ),
  'prev' => 
  array (
    0 => 'xsltprocessor.removeparameter.php',
    1 => 'XSLTProcessor::removeParameter',
  ),
  'next' => 
  array (
    0 => 'xsltprocessor.setprofiling.php',
    1 => 'XSLTProcessor::setProfiling',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/xsl/xsltprocessor/setparameter.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="xsltprocessor.setparameter" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">XSLTProcessor::setParameter</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">XSLTProcessor::setParameter</span> &mdash; <span class="dc-title">Set value for a parameter</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-xsltprocessor.setparameter-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>XSLTProcessor::setParameter</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$namespace</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$name</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$value</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><strong>XSLTProcessor::setParameter</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$namespace</code></span>, <span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$options</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Sets the value of one or more parameters to be used in subsequent 
   transformations with <span class="classname"><a href="class.xsltprocessor.php" class="classname">XSLTProcessor</a></span>. If the 
   parameter doesn&#039;t exist in the stylesheet it will be ignored.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-xsltprocessor.setparameter-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">namespace</code></dt>
     <dd>
      <p class="para">
       The namespace URI of the XSLT parameter.
      </p>
     </dd>
    
    
     <dt><code class="parameter">name</code></dt>
     <dd>
      <p class="para">
       The local name of the XSLT parameter.
      </p>
     </dd>
    
    
     <dt><code class="parameter">value</code></dt>
     <dd>
      <p class="para">
       The new value of the XSLT parameter.
      </p>
     </dd>
    
    
     <dt><code class="parameter">options</code></dt>
     <dd>
      <p class="para">
       An array of  <code class="literal">name =&gt; value</code> pairs.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-xsltprocessor.setparameter-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   Повертає <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> у разі успіху або <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> в разі помилки.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-xsltprocessor.setparameter-errors">
  <h3 class="title">Помилки/виключення</h3>
  <p class="simpara">
   Throws a <span class="exceptionname"><a href="class.valueerror.php" class="exceptionname">ValueError</a></span> if any of the arguments
   contain null bytes.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-xsltprocessor.setparameter-changelog">
  <h3 class="title">Журнал змін</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Версія</th>
      <th>Опис</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.4.0</td>
      <td>
       Now throws a <span class="exceptionname"><a href="class.valueerror.php" class="exceptionname">ValueError</a></span> if any of the
       arguments contain null bytes instead of silently truncating.
      </td>
     </tr>

     <tr>
      <td>8.4.0</td>
      <td>
       It is now possible to set a parameter value containing both single and
       double quotes. Prior to PHP 8.4.0, this resulted in a warning.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-xsltprocessor.setparameter-examples">
  <h3 class="title">Приклади</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Приклад #1 Changing the owner before the transformation</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$collections </span><span style="color: #007700">= array(<br />    </span><span style="color: #DD0000">'Marc Rutkowski' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'marc'</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'Olivier Parmentier' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'olivier'<br /></span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$xsl </span><span style="color: #007700">= new </span><span style="color: #0000BB">DOMDocument</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$xsl</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">(</span><span style="color: #DD0000">'collection.xsl'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Configure the transformer<br /></span><span style="color: #0000BB">$proc </span><span style="color: #007700">= new </span><span style="color: #0000BB">XSLTProcessor</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$proc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">importStyleSheet</span><span style="color: #007700">(</span><span style="color: #0000BB">$xsl</span><span style="color: #007700">); </span><span style="color: #FF8000">// attach the xsl rules<br /><br /></span><span style="color: #007700">foreach (</span><span style="color: #0000BB">$collections </span><span style="color: #007700">as </span><span style="color: #0000BB">$name </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">$file</span><span style="color: #007700">) {<br />    </span><span style="color: #FF8000">// Load the XML source<br />    </span><span style="color: #0000BB">$xml </span><span style="color: #007700">= new </span><span style="color: #0000BB">DOMDocument</span><span style="color: #007700">;<br />    </span><span style="color: #0000BB">$xml</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">(</span><span style="color: #DD0000">'collection_' </span><span style="color: #007700">. </span><span style="color: #0000BB">$file </span><span style="color: #007700">. </span><span style="color: #DD0000">'.xml'</span><span style="color: #007700">);<br /><br />    </span><span style="color: #0000BB">$proc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setParameter</span><span style="color: #007700">(</span><span style="color: #DD0000">''</span><span style="color: #007700">, </span><span style="color: #DD0000">'owner'</span><span style="color: #007700">, </span><span style="color: #0000BB">$name</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">$proc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">transformToURI</span><span style="color: #007700">(</span><span style="color: #0000BB">$xml</span><span style="color: #007700">, </span><span style="color: #DD0000">'file:///tmp/' </span><span style="color: #007700">. </span><span style="color: #0000BB">$file </span><span style="color: #007700">. </span><span style="color: #DD0000">'.html'</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-xsltprocessor.setparameter-seealso">
  <h3 class="title">Прогляньте також</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="xsltprocessor.getparameter.php" class="function" rel="rdfs-seeAlso">XSLTProcessor::getParameter()</a> - Get value of a parameter</span></li>
    <li><span class="function"><a href="xsltprocessor.removeparameter.php" class="function" rel="rdfs-seeAlso">XSLTProcessor::removeParameter()</a> - Remove parameter</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>