XSL XSLTProcessor::setParameter

(PHP 5, PHP 7, PHP 8)

XSLTProcessor::setParameter — 매개변수 값 설정


설명

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

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

XSLTProcessor를 사용한 후속 변환에 사용할 하나 이상의 매개변수 값을 설정합니다. 매개변수가 스타일시트에 없으면 무시됩니다.


매개변수

namespace
XSLT 매개변수의 네임스페이스 URI입니다.
name
XSLT 매개변수의 로컬 이름입니다.
value
XSLT 매개변수의 새 값입니다.
options
name => value 쌍의 배열입니다.

반환 값

성공하면 true를, 실패하면 false를 반환합니다.


Examples

예제 #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');
}

?>
                  
                

기타