XQuery in PHP 5 with Zorba
Have you wondered how you can harness the power of XQuery with PHP? Well, the response is: Zorba
Zorba I used a few years ago and has recently grown so much. For me, Zorba, is the most complete XQuery Processor.
- All Flavors Available
- Rich XQuery Library
- Pluggable Store
- Runs Everywhere
- Developer Friendly Tools
Zorba, supports, although currently only partially (read W3C XQuery 3.0 Partial Support), the specifications of the W3C XQuery 3.0.
You can try immediately (online), XQuery 3.0 support via Zorba XQuery. Below is an example of XQuery for grouping (3.10.7 Group By Clause).
for $sales in doc("sales-records.xml")/*/record
let $state := doc("stores.xml")/*/store[store-number = $sales/store-number]/state,
$product := doc("products.xml")/*/product[name = $sales/product-name],
$category := $product/category,
$revenue := $sales/qty * $product/price
group by $state, $category
order by $state, $category
Code 1. Example of XQuery grouping.
- Zorba 2.2.0 (news.freecode.com)
- Zorba Blog (www.zorba-xquery.com/html/blog)
- Cutting Edge Data Processing with PHP & XQuery (www.zorba-xquery.com/html/entry/2011/12/27/PHP_Meets_XQuery)
- Cutting Edge Data Processing with PHP & XQuery (www.slideshare.net/wcandillon/cutting-edge-data-processing-with-php-xquery)
- Building XQuery-powered applications with PHP and Zorba (www.ibm.com/developerworks/xml/library/x-zorba/index.html)