IMPRESS dotted_line CONTACT dotted_line search dotted_line Kontakt dotted_line sitemap dotted_line print
311 PHP-Resource users online

Switch to another languags Deutsch aktuelle Sprache Englisch

PHP Manual


(PHP 4 >= 4.0.6)

xslt_set_scheme_handlersSet the scheme handlers for the XSLT processor


void xslt_set_scheme_handlers ( resource $xh , array $handlers )

Registers the scheme handlers (XPath handlers) for the document.



The XSLT processor link identifier, created with xslt_create().


An array with the following keys: "get_all", "open", "get", "put", and "close".

Every entry must be a function name or an array in the following format: array($obj, "method").

Note that the given array does not need to contain all of the different scheme handler elements (although it can), but it only needs to conform to the "handler" => "fonction" format described above.

Each of the individual scheme handler functions called are in the formats below:

string   get_all(resource processor, string scheme, string rest)
resource open(resource processor, string scheme, string rest)
int      get(resource processor, resource fp, string &data)
int      put(resource processor, resource fp, string data)
void     close(resource processor, resource fp)

Return Values

No value is returned.


Example #1 xslt_set_scheme_handlers() example

For example, here is an implementation of the "file_exists()" PHP function.


// Definition of the handler
function mySchemeHandler($processor$scheme$rest)
$rest substr($rest,1);    // to remove the first / automatically added by the engine
if ($scheme == 'file_exists') {
// result is embedded in a small xml string
return '<?xml version="1.0" encoding="UTF-8"?><root>' . (file_exists($rest) ? 'true' 'false') . '</root>';

$SchemeHandlerArray = array('get_all' => 'mySchemeHandler');

// Start the engine
$params = array();
$xh xslt_create();


$result xslt_process($xh"myFile.xml""myFile.xsl"NULL, array(), $params);



Then, inside the stylesheet, you can test whether a certain file exists with:

<xsl:if test="document('file_exists:anotherXMLfile.xml')/root='true'">
 <!-- The file exist -->

See Also

Comments to the PHP manual
Write new comment


New Tutorial entries

Migration einer PHP 5 App auf PHP 7

Dieses PHP 7 Tutorial zeigt dir, wie du dein PHP5 Script auf PHP7 umstellst.

Berni | Category: PHP
PHP 7 Virtual Machine

Dieser Artikel zielt darauf ab, einen Überblick über die Zend Virtual Machine, wie es in PHP 7 gefunden wird.

Berni | Category: PHP
plotting masters - a professional guide - Teil II

Grafische Interpolation und Bestapproximation von numerischen Wertepaaren: Wir wollen Punkte auf einer Zeichenebene über verschiedene Verfahren miteinander verbinden.

EVAMasters | Category: PHP