XSLTProcessor->setParameter()

(no version information, might be only in CVS)

XSLTProcessor->setParameter() -- パラメータの値を設定する

説明

class XSLTProcessor {

bool setParameter ( string namespace, string name, string value )

}class XSLTProcessor {

bool setParameter ( string namespace, array options )

}

XSLTProcessor を使った変換のための 1 つあるいは多くのパラメータの値を設定します。 もしパラメータがスタイルシートに存在しない場合、無視されます。

パラメータ

namespace

XSLT パラメータの名前空間 URI を指定します。

name

XSLT パラメータのローカル名を指定します。パラメータ名に相当する文字列、 あるいは name => value の組の配列を指定可能です。

value

XSLT パラメータの新しい値を指定します。

options

名前 => 値 の組の配列を指定します。 この書式は PHP5.1.0 から利用可能です。

返り値

成功した場合に TRUE を、失敗した場合に FALSE を返します。

例 1. 返還前に所有者を変更する

<?php

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

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

// 変換の設定を行う
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules

foreach ($collections as $name => $file) {
    
// XML ソースをロードするLoad the XML source
    
$xml = new DOMDocument;
    
$xml->load('collection_' . $file . '.xml');

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

?>

参考

XSLTProcessor->getParameter()
XSLTProcessor->removeParameter()