# XSLTProcessor::importStylesheet

(PHP 5, PHP 7, PHP 8)

XSLTProcessor::importStylesheet — Import stylesheet

### 说明

public XSLTProcessor::importStylesheet(object `$stylesheet`): bool

This method imports the stylesheet into the XSLTProcessor for transformations.

### 参数

`stylesheet`

  The imported style sheet as a Dom\Document, DOMDocument or SimpleXMLElement object.

### 返回值

成功时返回 `true`， 或者在失败时返回 `false`。

### 错误／异常

Throws a TypeError if `stylesheet` is not an XML object.

### 更新日志

版本 | 说明
--- | ---
8.4.0 | Added support for Dom\Document.
8.4.0 | Now throws a TypeError instead of a ValueError if `stylesheet` is not an XML object.

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open