I’m currently working on a Java web project (Spring) which involves heavy use of xsl transformations. The stylesheets seldom change, so they are currently cached. I was thinking of improving performance by compiling the xsl-s into class files so they wouldn’t have to be interpreted on each request.
I’m new to Java, so I don’t really know the ecosystem that well. What’s the best way of doing this (libraries, methods etc.)?
Thanks,
Alex
You’ll need a Template and a stylesheet cache:
http://onjava.com/pub/a/onjava/excerpt/java_xslt_ch5/index.html?page=9
Do be careful about thread safety, because Transformers aren’t thread safe. Best to do your transformations in a ThreadLocal for isolation.