PhpDig.net

What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.




xslt_run

Name

xslt_run — Applies a stylesheet from one file to XML data from another.

Synopsis

boolean xslt_run(xslt_handle, xsl_URI, xml_URI[, result_URI][, xslt_parameters][, xslt_arguments]);
resource xslt_handle: Handle to the Sablotron parser to use
string xsl_URI: Filename of XSL stylesheet
string xml_URI: Filename of file containing XML data to parse
string result_URI (optional): Name of buffer in which to place results
array xslt_parameters (optional): Array of XSLT parameters to use with the stylesheet
int xslt_arguments (optional): Array of buffer names to use with the stylesheet

Returns

TRUE if processing succeeds; FALSE otherwise.

Description

Takes a handle to a Sablotron parser and the URIs of a stylesheet and an XML document. The stylesheet transformation is applied to the data from the XML document and placed into the result buffer specified by result_URI . If no value is give for result_URI , then the default value of 'arg:/_result' will be used. xslt_parameters should contain a list of any variables to be passed to the stylesheet; xslt_arguments allows you to pass a list of named document buffers to the stylesheet.

After a successful transformation, the resulting document may be retrieved using xslt_fetch_result() .

Example

Example 1145. Applying a stylesheet from one file to XML from another file

<?php
error_reporting(E_ALL);

$xml_file = 'slashdot.xml';
$xsl_file = 'slashdot.xsl';
$xslt = xslt_create();
if (!xslt_run($xslt, $xsl_file, $xml_file)) {
    echo "xslt_run() failed\n";
} else {
    echo xslt_fetch_result($xslt);
}
xslt_closelog($xslt);
xslt_free($xslt);
?>



PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing (Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch). This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/). The authors of this book have elected not to choose any options under the OPL. This online book was obtained from http://www.fooassociates.com/phpfer/ and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4 for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All persons and entities shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information contained in this book.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.