此扩展需要 libxml PHP 扩展。这表示需要使用 --enable-libxml ,尽管这将隐式完成因为 libxml 是缺省开启的。
安装
PHP 5默认包含XSL扩展,可以通过将参数XSL[=DIR]添加到配置行(DIR是libxslt安装目录)来启用。
XSLTProcessor类
(PHP 5, PHP 7)XSLTProcessor
{
/* 方法 */
getParameter ( string $namespaceURI , string $localName ) : string
public getSecurityPrefs ( void ) : int
hasExsltSupport ( void ) : bool
public importStylesheet ( object $stylesheet ) : bool
registerPHPFunctions ([ mixed $restrict ] ) : void
removeParameter ( string $namespaceURI , string $localName ) : bool
setParameter ( string $namespace , string $name , string $value ) : bool
setProfiling ( string $filename ) : bool
public setSecurityPrefs ( int $securityPrefs ) : int
transformToDoc ( DOMNode $doc ) : DOMDocument
transformToURI ( DOMDocument $doc , string $uri ) : int
transformToXml ( object $doc ) : string
}
例子
本参考中的许多示例都需要XML和XSL文件。我们将使用collection.xml和collection.xsl,其中包含以下内容:
Fight for your mindBen Harper
1995
Electric LadylandJimi Hendrix
1997
Hey! Welcome to 's sweet CD collection!