xslt_transformSynopsis
DescriptionThis function applies the stylesheet contained in the file named by xslt_URI to the XML document named by xml_URI . The results of the transformation are then placed into the internal buffer named by result_URI , which must use the 'arg:' URI scheme. xslt_parameters , if given, should contain a list of variables to be passed to the stylesheet. The xslt_arguments array, if given, is a list of named document buffers to be passed to the stylesheet. ExampleExample 1147. Using xslt_transform() in different ways <?php echo "<h3>Straight & simple processing</h3>\n"; $result = ''; if (xslt_transform('slashdot.xsl', 'slashdot.xml', 'arg:/_result', 0, 0, $result)) { echo $result; } else { echo xslt_error(); } echo "<h3>Using named buffers</h3>\n"; $result = ''; $arglist = array('xslbuffer' => join('', file('slashdot.xsl')), 'xmlbuffer' => join('', file('slashdot.xml'))); if (xslt_transform('arg:/xslbuffer', 'arg:/xmlbuffer', 'arg:/_result', 0, $arglist, $result)) { echo $result; } else { echo xslt_error(); } echo "<h3>Providing parameters</h3>\n"; $result = ''; $params = array('generated-for' => 'Torben Wilson'); if (xslt_transform('slashdot.xsl', 'slashdot.xml', 'arg:/_result', $params, 0, $result)) { echo $result; } else { echo xslt_error(); } ?>
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.
|