How to execute a XQuery in PHP? Can you give me an example?
Thank you.
There is this page at http://phpxmlclasses.sourceforge.net/ that has an XQuery Lite class:
A PHP implementation of the Xquery Lite 1.0 language, a language to query XML documents based on Xquery 1.0 This class is based on the DOM extension and allows to execute Xquery Lite queries for XML documents in files, php strings or combinations.
I have never used it and do not know how it performs.
The following link should be useful: http://dl.dropbox.com/u/1487285/php/php.html
<?php
require_once 'Zorba/XQueryProcessor.php';
$xquery = new XQueryProcessor();
$query = <<<'XQ'
declare variable $world external;
<h1>Hello {$world}</h1>
XQ;
$xquery->importQuery($query);
$xquery->setVariable('world', 'World!');
echo $xquery->execute();
?>