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 |
|---|
stringXML String with literal entities
stringXML string with numeric entitesprintErrors() : void
| access | public |
|---|
process() : string
| access | public |
|---|
stringTransformed datareadFromFile(string $file) : string
| access | private |
|---|
stringFile location
stringFile contentssetParam(string $name, string $value) : void
The parameters can be accessed in XSL
with
stringName
stringValue
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 |
|---|
arrayarray("scheme"=>"schemeHandlerName");
setXml(string $xml) : void
| access | public |
|---|
stringThe XML String
setXmlFile(string $file) : void
| access | public |
|---|
stringLocation of the XML file
setXsl(string $xsl) : void
| access | public |
|---|
stringThe XML String
setXslFile(string $file) : void
| access | public |
|---|
stringLocation 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 |
|---|