Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

xslt_set_scheme_handlers

(PHP 4 >= 4.0.6, PECL)

xslt_set_scheme_handlers --  Set the scheme handlers for the XSLT processor

Description

void xslt_set_scheme_handlers ( resource processor, array handlers )

Внимание

К настоящему времени эта функция еще не была документирована; для ознакомления доступен только список аргументов.



add a note add a note User Contributed Notes
xslt_set_scheme_handlers
cchittleborough at cluemail dot com
12-Sep-2004 06:36
Here's some useful information I found in the PHP 4.3.4 source (in the file ext/xslt/README.XSLT-BACKENDS):

void xslt_set_scheme_handlers(resource processor, array handlers)

Registers the scheme handlers for the document (aka XPath handlers), given a XSLT processor resource (allocated by xslt_create()) and an array in the following format:
 
    array(
       "get_all" => function,
       "open"    => function,
       "get"      => function,
       "put"      => function,
       "close"    => function
    )
 
Where function is either a function name or an array in the following format:
 
    array(&$obj, "method")

Note:  You do not need to handle the array(&$obj, method") syntax by yourself as this is handled in the C call_xslt_function() library function (and more specifically, Zend's call_user_function_ex() function.

Note:  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" => "function" 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)
ohlesbeauxjours at yahoo dot fr
20-Mar-2003 11:49
xslt_set_scheme_handlers is a powerful feature, derived from the Sablotron engine, which can help in various situations.

Briefly, it allows you to call any kind of PHP instruction, during the treatment of a stylesheet, through the XSLT document() function.

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')
    return '<?xml version="1.0" encoding="UTF-8"?><root>'.(file_exists($rest) ? "true" : "false")."</root>";
    // result is embedded in a small xml string
}

// Initialisation of the handler (the "get_all"  should be work in most cases) :
$SchemeHandlerArray = array();
$SchemeHandlerArray["get_all"] = "mySchemeHandler";

// Start the engine :
$params = array();
$xh = xslt_create();
xslt_set_scheme_handlers($xh,$SchemeHandlerArray);
$result = xslt_process($xh,"myFile.xml","myFile.xsl",NULL,array(),$params);
xslt_free($xh);
echo $result;

Then, inside the stylesheet, you can test whether a certain file exists with :
<xsl:if test="document('file_exists:anotherXMLfile.xml
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571