Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP Manual > xslt_set_scheme_handlers - Set the scheme handlers for the XSLT processor





ลองใช้ค้นหาข้อมูล


   
Bookmark.

xslt_set_scheme_handlers

(PHP 4 >= 4.0.6)

xslt_set_scheme_handlersSet the scheme handlers for the XSLT processor

Description

void xslt_set_scheme_handlers ( resource $xh , array $handlers )

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

Parameters

xh

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

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() 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>



ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 03
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่