XSLTProcessor
PHP Manual

XSLTProcessor::setParameter

(PHP 5)

XSLTProcessor::setParameterتعیین مقدار برای پارامتر

Description

bool XSLTProcessor::setParameter ( string $namespace , string $name , string $value )
bool XSLTProcessor::setParameter ( string $namespace , array $options )

تعیین مقدار برای یک یا تعداد بیشتری پارامتر در تبدیلات بعدی با XSLTProcessor. اگر پارامتر در stylesheet موجود نباشد نادیده گرفته می‌شود.

Parameters

namespace

فضای نام URI پارامتر XSLT.

name

نام محلی پارامتر XSLT.

value

مقدار جدید پارامتر XSLT.

options

آرایه جفت‌های name => value. این دستور از PHP 5.1.0 موجود است.

Return Values

Returns TRUE on success or FALSE on failure.

Examples

Example #1 تغییر مالک پیش از تبدیل

<?php

$collections 
= array(
    
'Marc Rutkowski' => 'marc',
    
'Olivier Parmentier' => 'olivier'
);

$xsl = new DOMDocument;
$xsl->load('collection.xsl');

// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules

foreach ($collections as $name => $file) {
    
// Load the XML source
    
$xml = new DOMDocument;
    
$xml->load('collection_' $file '.xml');

    
$proc->setParameter('''owner'$name);
    
$proc->transformToURI($xml'file:///tmp/' $file '.html');
}

?>

See Also


XSLTProcessor
PHP Manual