Open Journal Systems  2.4.4
 All Classes Namespaces Functions Variables Groups Pages
XSLTransformer Class Reference

Public Member Functions

_transformExternal (&$xml, $xmlType, &$xsl, $xslType, $resultType)
 
_transformPHP4 (&$xml, $xmlType, &$xsl, $xslType, $resultType)
 
_transformPHP5 (&$xml, $xmlType, &$xsl, $xslType, $resultType)
 
 addError ($error)
 
 getProcessor ()
 
 setParameters ($parameters)
 
 setRegisterPHPFunctions ($flag)
 
transform (&$xml, $xmlType, &$xsl, $xslType, $resultType)
 
 transformFiles ($xmlFile, $xslFile)
 
 transformStrings ($xml, $xsl)
 
 XSLTransformer ()
 

Detailed Description

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

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

Member Function Documentation

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

Use external programs to do the XSL transformation

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

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

References addError().

Referenced by transform().

& XSLTransformer::_transformPHP4 ( $xml,
  $xmlType,
$xsl,
  $xslType,
  $resultType 
)

Use PHP4's xslt extension to do the XSL transformation

Parameters
$xmlmixed
$xmlTypeinteger
$xslmixed
$xslTypeinteger
$resultTypeinteger
Returns
string return type for PHP4 is always string or "false" on error.

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

References addError().

Referenced by transform().

& XSLTransformer::_transformPHP5 ( $xml,
  $xmlType,
$xsl,
  $xslType,
  $resultType 
)

Use PHP5's DOMDocument and XSLTProcessor to do the transformation

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

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

Referenced by transform().

XSLTransformer::addError (   $error)

Add an error to the current error list

Parameters
$errorstring

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

Referenced by _transformExternal(), and _transformPHP4().

XSLTransformer::getProcessor ( )

Get the processor type

Returns
string

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

XSLTransformer::setParameters (   $parameters)

Set the parameter list for internal processors.

Parameters
array$parameters

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

XSLTransformer::setRegisterPHPFunctions (   $flag)

Set the registerPHPFunctions setting on or off.

Parameters
boolean$flag

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

& 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
Returns
mixed return type depends on the $returnType 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 137 of file XSLTransformer.inc.php.

References _transformExternal(), _transformPHP4(), and _transformPHP5().

Referenced by transformFiles(), and transformStrings().

XSLTransformer::transformFiles (   $xmlFile,
  $xslFile 
)

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

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

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

References transform().

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 121 of file XSLTransformer.inc.php.

References transform().

XSLTransformer::XSLTransformer ( )

Constructor. Initialize transformer and set parser options.

Returns
boolean returns false if no XSLT processor could be created

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

References Config\getVar().


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