XsltProcessor()
_init()
free()
literal2NumericEntities()
printErrors()
process()
readFromFile()
setParam()
setSchemeHandlers()
setXml()
setXmlFile()
setXsl()
setXslFile()
$arguments
$autofree
$errno
$error
$parameters
$processor
$result
$xml
$xslt
XSLT_Processor
Wrapper class for the Sablotron XSLT extension
!!! REQUIRES Installed Sablotron to run !!!
Example:
$xslt = new XSLT_Processor;
$xslt->setXmlFile("foo.xml"); $xslt->setXslFile("bar.xslt");
$html = $xslt->process();
XsltProcessor()
access | private |
---|
_init() : void
access | private |
---|
free() : void
literal2NumericEntities(string $stringXml) : string
access | private |
---|
string
XML String with literal entities
string
XML string with numeric entitesprintErrors() : void
access | public |
---|
process() : string
access | public |
---|
string
Transformed datareadFromFile(string $file) : string
access | private |
---|
string
File location
string
File contentssetParam(string $name, string $value) : void
The parameters can be accessed in XSL
with
string
Name
string
Value
setSchemeHandlers(array $aHandlers) : void
Example param array:
array("get_all", "mySchemeHandler")
Example scheme handler function:
function mySchemeHandler($processor, $scheme, $param) { // to remove the first slash added by Sablotron $param = substr($param, 1);
if ($scheme == 'file_exists')
{ // result is returned as valid xml string
return '<?xml version="1.0" encoding="UTF-8"?><root>'.(file_exists($param) ? "true" : "false")."</root>";
}
}
To use the schema handler use:
To call the external function use the 'document()' XSLT-Function.
Schemename and parameter will be passed to the handler function as second and third parameter. The return value of the function must be valid XML to access it using XPath.
access | public |
---|
array
array("scheme"=>"schemeHandlerName");
setXml(string $xml) : void
access | public |
---|
string
The XML String
setXmlFile(string $file) : void
access | public |
---|
string
Location of the XML file
setXsl(string $xsl) : void
access | public |
---|
string
The XML String
setXslFile(string $file) : void
access | public |
---|
string
Location of the XSL file
$arguments : array
access | private |
---|
$autofree : bool
access | private |
---|
$errno : int
access | private |
---|
$error : string
access | private |
---|
$parameters : array
access | private |
---|
$processor : object
access | private |
---|
$result : string
access | private |
---|
$xml : string
access | private |
---|
$xslt : string
access | private |
---|