Sort of ...
Looking through the W3C implementations list for XQuery there is:
- Python bindings for Zorba
- Sendna, but might not be what you're after
A few Python examples with Zobra, from here
import sys
import zorba_api
def example1(zorba):
xquery = zorba.compileQuery("1+2")
print xquery.printPlanAsXML()
print xquery.execute()
return
def example2(zorba):
xquery = zorba.compileQuery("(1,2,3,4,5)")
iter = xquery.iterator()
iter.open()
item = zorba_api.Item_createEmptyItem()
while iter.next(item):
print item.getStringValue()
iter.close()
iter.destroy()
return
def example3(zorba):
try:
xquery = zorba.compileQuery("1 div 0")
print xquery.execute()
except RuntimeError, e:
print e
return
There may be C implementation in that list which can easily be bound to Python. Hope this helps, I was somewhat surprised to see so few implementations. Although, XQuery isn't the most desired of the XML tools I suppose.