class XSLTProcessor (View source)

Methods

bool
importStylesheet(object $stylesheet)

Import stylesheet

object|false
transformToDoc(object $document, string|null $returnClass = null)

Transform to a DOMDocument

int
transformToUri(DOMDocument|SimpleXMLElement $document, string $uri)

Transform to URI

string|false|null
transformToXml(DOMDocument|SimpleXMLElement $document)

Transform to XML

bool
setParameter(string $namespace, string $name, string $value = null)

Set value for a parameter

string|false
getParameter(string $namespace, string $name)

Get value of a parameter

bool
removeParameter(string $namespace, string $name)

Remove parameter

bool
hasExsltSupport()

Determine if PHP has EXSLT support

void
registerPHPFunctions(array|string|null $functions = null)

Enables the ability to use PHP functions as XSLT functions

bool
setProfiling(string $filename)

Sets profiling output file

int
setSecurityPrefs(int $preferences)

Set security preferences

int
getSecurityPrefs()

Get security preferences

Details

bool importStylesheet(object $stylesheet)

Import stylesheet

Parameters

object $stylesheet

The imported style sheet as a DOMDocument or SimpleXMLElement object.

Return Value

bool

TRUE on success or FALSE on failure.

object|false transformToDoc(object $document, string|null $returnClass = null)

Transform to a DOMDocument

Parameters

object $document

The DOMDocument or SimpleXMLElement or libxml-compatible object to be transformed.

string|null $returnClass

Return Value

object|false

The resulting DOMDocument or FALSE on error.

int transformToUri(DOMDocument|SimpleXMLElement $document, string $uri)

Transform to URI

Parameters

DOMDocument|SimpleXMLElement $document

The document to transform.

string $uri

The target URI for the transformation.

Return Value

int

the number of bytes written or FALSE if an error occurred.

string|false|null transformToXml(DOMDocument|SimpleXMLElement $document)

Transform to XML

Parameters

DOMDocument|SimpleXMLElement $document

The transformed document.

Return Value

string|false|null

The result of the transformation as a string or FALSE on error.

bool setParameter(string $namespace, string $name, string $value = null)

Set value for a parameter

Parameters

string $namespace

The namespace URI of the XSLT parameter.

string $name

The local name of the XSLT parameter.

string $value

The new value of the XSLT parameter.

Return Value

bool

TRUE on success or FALSE on failure.

string|false getParameter(string $namespace, string $name)

Get value of a parameter

Parameters

string $namespace

The namespace URI of the XSLT parameter.

string $name

The local name of the XSLT parameter.

Return Value

string|false

The value of the parameter (as a string), or FALSE if it's not set.

bool removeParameter(string $namespace, string $name)

Remove parameter

Parameters

string $namespace

The namespace URI of the XSLT parameter.

string $name

The local name of the XSLT parameter.

Return Value

bool

TRUE on success or FALSE on failure.

bool hasExsltSupport()

Since: 5.0.4

Determine if PHP has EXSLT support

Return Value

bool

TRUE on success or FALSE on failure.

void registerPHPFunctions(array|string|null $functions = null)

Since: 5.0.4

Enables the ability to use PHP functions as XSLT functions

Parameters

array|string|null $functions

[optional]

Use this parameter to only allow certain functions to be called from XSLT.

This parameter can be either a string (a function name) or an array of functions.

Return Value

void

No value is returned.

bool setProfiling(string $filename)

Sets profiling output file

Parameters

string $filename

Path to the file to dump profiling information.

Return Value

bool

TRUE on success or FALSE on failure.

int setSecurityPrefs(int $preferences)

Since: 5.4

Set security preferences

Parameters

int $preferences

Return Value

int

int getSecurityPrefs()

Since: 5.4

Get security preferences

Return Value

int