I agree it appears confused.
My theory was to query the db once - convert to XML then use multiple XSLT passes to build whatever output format I needed be it HTML, CSV or different XML format.
It works ok - but the important thing is that I now know a hell of a lot more than when I started