The XSLTProcessor class

- « Error handling with libxml error handling functions

- XSLTProcessor::__construct »

- PHP Manual
- XSL
- The XSLTProcessor class

# The XSLTProcessor class

(PHP 5, PHP 7, PHP 8)

## Introduction

## Class synopsis

class XSLTProcessor {
/* Properties */
public bool $doXInclude = false;
public bool $cloneDocument = false;
public int $maxTemplateDepth;
public int $maxTemplateVars;
/* Methods */
public getParameter(string `$namespace`, string `$name`): string|false
public getSecurityPrefs(): int
public hasExsltSupport(): bool
public importStylesheet(object `$stylesheet`): bool
public registerPHPFunctionNS(string `$namespaceURI`, string `$name`, callable `$callable`): void
public registerPHPFunctions(array|string|null `$functions` = `null`): void
public removeParameter(string `$namespace`, string `$name`): bool
public setParameter(string `$namespace`, string `$name`, string `$value`): bool
public setParameter(string `$namespace`, array `$options`): bool
public setProfiling(?string `$filename`): true
public setSecurityPrefs(int `$preferences`): int
public transformToDoc(object `$document`, ?string `$returnClass` = `null`): object|false
public transformToUri(object `$document`, string `$uri`): int
public transformToXml(object `$document`): string|null|false
}

## Properties

doXInclude
  Whether to perform xIncludes.
cloneDocument
  Whether to perform the transformation on a clone of the document.
maxTemplateDepth
  The maximum template recursion depth.
maxTemplateVars
  The maximum number of variables in the template.

## Changelog

Version | Description
--- | ---
8.4.0 | The properties doXInclude and cloneDocument are now explicitly defined on the class.
8.4.0 | Added properties maxTemplateDepth and maxTemplateVars.

## Table of Contents

- XSLTProcessor::__construct — Creates a new XSLTProcessor object
- XSLTProcessor::getParameter — Get value of a parameter
- XSLTProcessor::getSecurityPrefs — Get security preferences
- XSLTProcessor::hasExsltSupport — Determine if PHP has EXSLT support
- XSLTProcessor::importStylesheet — Import stylesheet
- XSLTProcessor::registerPHPFunctionNS — Register a PHP function as namespaced XSLT function
- XSLTProcessor::registerPHPFunctions — Enables the ability to use PHP functions as XSLT functions
- XSLTProcessor::removeParameter — Remove parameter
- XSLTProcessor::setParameter — Set value for a parameter
- XSLTProcessor::setProfiling — Sets profiling output file
- XSLTProcessor::setSecurityPrefs — Set security preferences
- XSLTProcessor::transformToDoc — Transform to a document
- XSLTProcessor::transformToUri — Transform to URI
- XSLTProcessor::transformToXml — Transform to XML