Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xslt_set_scheme_handlers(3) [php man page]

XSLT_SET_SCHEME_HANDLERS(3)						 1					       XSLT_SET_SCHEME_HANDLERS(3)

xslt_set_scheme_handlers - Set the scheme handlers for theXSLTprocessor

SYNOPSIS
void xslt_set_scheme_handlers (resource $xh, array $handlers) DESCRIPTION
Registers the scheme handlers (XPath handlers) for the document. PARAMETERS
o $ xh -The XSLT processor link identifier, created with xslt_create(3). o $handlers - 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" => "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) RETURN VALUES
No value is returned. EXAMPLES
Example #1 xslt_set_scheme_handlers(3) example For example, here is an implementation of the "file_exists()" PHP function. <?php // 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(); 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')/root='true'"> <!-- The file exist --> </xsl:if> SEE ALSO
xslt_set_scheme_handler(3). PHP Documentation Group XSLT_SET_SCHEME_HANDLERS(3)

Check Out this Related Man Page

ITERATOR_TO_ARRAY(3)							 1						      ITERATOR_TO_ARRAY(3)

iterator_to_array - Copy the iterator into an array

SYNOPSIS
array iterator_to_array (Traversable $iterator, [bool $use_keys = true]) DESCRIPTION
Copy the elements of an iterator into an array. PARAMETERS
o $iterator - The iterator being copied. o $use_keys - Whether to use the iterator element keys as index. In PHP 5.5 and later, if a key is an array or object, a warning will be gen- erated. NULL keys will be converted to an empty string, double keys will be truncated to their integer counterpart, resource keys will generate a warning and be converted to their resource ID, and boolean keys will be converted to integers. RETURN VALUES
An array containing the elements of the $iterator. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.5.0 | | | | | | | iterator_to_array(3) gained support for key types | | | other than integer and string when the $use_keys | | | parameter is enabled. | | | | | 5.2.1 | | | | | | | The $use_keys parameter was added. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 iterator_to_array(3) example <?php $iterator = new ArrayIterator(array('recipe'=>'pancakes', 'egg', 'milk', 'flour')); var_dump(iterator_to_array($iterator, true)); var_dump(iterator_to_array($iterator, false)); ?> The above example will output: array(4) { ["recipe"]=> string(8) "pancakes" [0]=> string(3) "egg" [1]=> string(4) "milk" [2]=> string(5) "flour" } array(4) { [0]=> string(8) "pancakes" [1]=> string(3) "egg" [2]=> string(4) "milk" [3]=> string(5) "flour" } PHP Documentation Group ITERATOR_TO_ARRAY(3)
Man Page