[xquery-talk] Linking Saxon through to exist database

Andrew Welch andrew.j.welch at gmail.com
Sat Jan 24 16:00:44 PST 2009

> My simple logic.
> XSLT isn't very good at big files.
> An xml database should be better.

Yes, hopefully not too far away from XSLT being good at big files too  :)

> Saxon provides an xquery interface.
> Why can't I use the two together?

It would need to know about eXist's underlying data model, how to use
its indexes etc

> Yes, selecting nodes from an xml file or collection of files
> in the exist database is the goal.
> It did work with the exist REST interface.... can you
> explain a bit better what you mean by treating exist
> as a filestore? ... What else is exist?

ok, for example you have 10,000 xml file of 1mb each stored in eXist -
if each doc had a <title> element you could get all of them by doing


and this would be very fast as eXist has indexed all the elements etc.

If you were using Saxon and going through the REST interface you would
have to either:

- get each individual document through say the doc() function (so the
xml may as well just be on your filesystem)

- write a query in eXist that gets all the title elements and returns
well-formed xml, and then hit that with the doc() function from Saxon.
 This is good, however eXist will build and serialise the intermediate
tree which Saxon will then reparse... (and you also have to code to
that intermediate tree rather than the data itself)

> Sounds like I'm missing another api into exist?
> The "smart" one?

Just write your xquery in eXist... I'd only use Saxon for XSLT 2.0

Andrew Welch
Kernow: http://kernowforsaxon.sf.net/

More information about the talk mailing list