That's exactly the problem. Here's the dilemma: I could restrict the types of queries you can do to a subset where the results are neatly marked up (using a template) to get the data in a form that's more complex than
but then I'm constrained in terms of the things you can ask, or I can allow for more flexibility in terms of the queries but then I can't really see how I could get output that is not as generic.