We currently use XSL Templates for generating our web site. Most of the web site is fairly simple, though there are a couple of pages that aren't. These pages tend to need to load a huge amount of data from the database, representing various things. However, depending on the permissions of the user opening the page, they may not need all of it. e.g. the user may only be allowed to view the Applicant's First Name, Surname, DOB, etc, but not their address or financial history. Given that, loading and converting this information to XML is a complete waste of time.
However, there's a problem with that: I can't see a way to use a Java Object as a Source for an XSL Transformation without having to convert it to XML in some way.
I have had a look at JAXB, but while that's very close, it's not quite what I'd like - basically, it converts the entire object graph into XML, without any knowledge of whether that part of the object graph is being used or not, but at least it only needs to traverse the object graph once, as opposed to our current approach, which traverses the object graph once to create the Document, and then has to traverse the Document again during the transform.
Is what I want to do possible? Or am I completely SOL?
For reference, I'm currently using the following libraries/JEE Container/JDK:
Sun Java 6
So if there's better libraries out there that I should be using, I'd like to know.
Anyway, if I can't, then there's other options:
Use JSPs or similar.
Use AJAX for the most expensive and yet least used data.
Write a custom framework around, say, JAXB that does what I want, probably coupled with a custom XSL Transformer...
Of those, the second is probably the most likely. But if there is a way to use Lazy Loading and XSL Templates, I'd really, really like to know.
As for your question, I wrote a website driven by XSL Transform a few years ago, and my interface from the database to the transformations consisted of a stream of SAX events. You might give that a try.