Open Journal Systems  3.3.0
XSLTransformer Class Reference

Public Member Functions

 __construct ()
 
 _transformExternal ($xml, $xmlType, $xsl, $xslType, $resultType)
 
 _transformPHP ($xml, $xmlType, $xsl, $xslType, $resultType)
 
 addError ($error)
 
 setParameters ($parameters)
 
 setRegisterPHPFunctions ($flag)
 
 transform ($xml, $xmlType, $xsl, $xslType, $resultType)
 
 transformFiles ($xmlFile, $xslFile)
 
 transformStrings ($xml, $xsl)
 

Static Public Member Functions

static checkSupport ()
 
static getProcessor ()
 

Data Fields

 $errors
 
 $parameters
 
 $registerPHPFunctions
 

Static Public Attributes

static $externalCommand
 
static $externalParameterSnippet
 
static $processor
 

Detailed Description

Wrapper class for running XSL transformations using PHP 4.x or 5.x.

Definition at line 24 of file XSLTransformer.inc.php.

Constructor & Destructor Documentation

◆ __construct()

XSLTransformer::__construct ( )

Constructor. Initialize transformer and set parser options.

Returns
boolean returns false if no XSLT processor could be created

Definition at line 67 of file XSLTransformer.inc.php.

References checkSupport().

Member Function Documentation

◆ _transformExternal()

XSLTransformer::_transformExternal (   $xml,
  $xmlType,
  $xsl,
  $xslType,
  $resultType 
)

Use external programs to do the XSL transformation

Parameters
$xmlmixed
$xmlTypeinteger
$xslmixed
$xslTypeinteger
$resultTypeinteger XSL_TRANSFORMER_DOCTYPE_...
Returns
mixed return type depends on the $resultType parameter and can be DOMDocument or string. Returns boolean "false" on error.

Definition at line 200 of file XSLTransformer.inc.php.

References addError().

Referenced by transform().

◆ _transformPHP()

XSLTransformer::_transformPHP (   $xml,
  $xmlType,
  $xsl,
  $xslType,
  $resultType 
)

Use PHP5's DOMDocument and XSLTProcessor to do the transformation

Parameters
$xmlmixed
$xmlTypeinteger
$xslmixed
$xslTypeinteger
$resultTypeinteger XSL_TRANSFORMER_DOCTYPE_...
Returns
mixed return type depends on the $resultType parameter and can be DOMDocument or string. Returns boolean "false" on error.

Definition at line 266 of file XSLTransformer.inc.php.

References $processor.

Referenced by transform().

◆ addError()

XSLTransformer::addError (   $error)

Add an error to the current error list

Parameters
$errorstring

Definition at line 362 of file XSLTransformer.inc.php.

Referenced by _transformExternal().

◆ checkSupport()

static XSLTransformer::checkSupport ( )
static

Fetch configuration and check whether XSLT is properly supported.

Returns
boolean True iff XSLT support is present.

Definition at line 78 of file XSLTransformer.inc.php.

References Config\getVar().

Referenced by __construct(), and InstallForm\display().

◆ getProcessor()

static XSLTransformer::getProcessor ( )
static

Get the processor type

Returns
string

Definition at line 107 of file XSLTransformer.inc.php.

References $processor.

◆ setParameters()

XSLTransformer::setParameters (   $parameters)

Set the parameter list for internal processors.

Parameters
$parametersarray

Definition at line 115 of file XSLTransformer.inc.php.

References $parameters.

◆ setRegisterPHPFunctions()

XSLTransformer::setRegisterPHPFunctions (   $flag)

Set the registerPHPFunctions setting on or off.

Parameters
$flagboolean

Definition at line 123 of file XSLTransformer.inc.php.

◆ transform()

XSLTransformer::transform (   $xml,
  $xmlType,
  $xsl,
  $xslType,
  $resultType 
)

Apply an XSLT transform to a given XML and XSL. Both parameters can be either strings, files or DOM objects.

Parameters
$xmlmixed
$xmlTypeinteger
$xslmixed
$xslTypeinteger
$resultTypeinteger XSL_TRANSFORMER_DOCTYPE_...
Returns
mixed return type depends on the $resultType parameter and can be DOMDocument or string. The method returns a boolean value of false if the transformation fails for some reason.

Definition at line 161 of file XSLTransformer.inc.php.

References _transformExternal(), and _transformPHP().

Referenced by transformFiles(), and transformStrings().

◆ transformFiles()

XSLTransformer::transformFiles (   $xmlFile,
  $xslFile 
)

Apply an XSLT transform to a given XML and XSL source files

Parameters
$xmlFilestring absolute pathname to the XML source file
$xslFilestring absolute pathname to the XSL stylesheet
Returns
string containing the transformed XML output, or false on error

Definition at line 135 of file XSLTransformer.inc.php.

References transform().

◆ transformStrings()

XSLTransformer::transformStrings (   $xml,
  $xsl 
)

Apply an XSLT transform to a given XML and XSL strings

Parameters
$xmlstring containing source XML
$xslstring containing source XSL
Returns
string containing the transformed XML output, or false on error

Definition at line 145 of file XSLTransformer.inc.php.

References transform().

Field Documentation

◆ $errors

array XSLTransformer::$errors

List of error strings

Definition at line 60 of file XSLTransformer.inc.php.

◆ $externalCommand

string XSLTransformer::$externalCommand
static

containing external XSLT shell command

Definition at line 36 of file XSLTransformer.inc.php.

◆ $externalParameterSnippet

string XSLTransformer::$externalParameterSnippet
static

containing external XSLT shell arguments for parameters

Definition at line 42 of file XSLTransformer.inc.php.

◆ $parameters

array XSLTransformer::$parameters

of parameters to pass to XSL (built-in libraries only)

Definition at line 48 of file XSLTransformer.inc.php.

Referenced by setParameters().

◆ $processor

string XSLTransformer::$processor
static

determining the XSLT processor to use for this object

Definition at line 30 of file XSLTransformer.inc.php.

Referenced by _transformPHP(), and getProcessor().

◆ $registerPHPFunctions

array XSLTransformer::$registerPHPFunctions

of PHP functions to allow in XSL (PHP5 built-in only)

Definition at line 54 of file XSLTransformer.inc.php.


The documentation for this class was generated from the following file: