Would like to ask you some more newbie questions. :-)
I see that the jar file auto-generated by the XSL has a no of translet class files named something like (if I set the translet-name to 'translet-name')
<translet-name>.class
<translet-name>$0.class
<translet-name>$1.class
<translet-name>$2.class
..
..
<translet-name>$18.class
Although that in my single request window, the 'TransformerFactory.newTemplates()' methods is being called just once, which is the following code snippet
---snip--
_templates = transformerFactory.newTemplates(new DOMSource(xslDoc));
----snip--
And also a new Transformer is being created only once, which is the following code snippet
---snip--
transformer = _templates.newTransformer();
----snip--
What is the reason for so many class files getting created? Is there something like a default pool size that has something to do with it. How can that be controlled
My whole purpose of switching over to compilation based XSLTC is get better performance. But with a single request, I see hardly a 10% improvement in performance (in a case where the translet is pre-generated). What could I be missing in terms of better tuning XSLTC? Are there any benchmark figures that show compilation mode XSLTC as a better transformer than the interpretative mode?
Thanks a lot!
Gaurav
Morris Kwan wrote:
Hi, Gaurav You can set the "auto-translet" attribute to true. If "auto-translet" is set to true, the TransformerFactory will create a Templates object from the existing translet if the translet exists and its time stamp is newer than the .xsl file, otherwise it will generate a new translet from the stylesheet. The "auto-translet" and "generate-translet" options should not be used with the "use-classpath" option. If they are used together, "use-classpath" will take precedence. Regards, Morris Kwan XSLT Development IBM Toronto Lab Tel: (905)413-3729 Email: [EMAIL PROTECTED] Gaurav <[EMAIL PROTECTED] n.COM> To [EMAIL PROTECTED] 11/28/2003 02:34 cc PM Subject Apache Xalan-J XSLTC: how to set Please respond to for on-demand XSL compilation Gaurav.Gandhi Summary: I am trying to use Xalan-J's compilation based TransformerFactory to create "Translets" on the fly. But dont know how to do that. (http://xml.apache.org/xalan-j/xsltc_usage.html) Details: I set the concerned system property to point to Xalans compilation based Transformer Properties props = System.getProperties(); props.put("javax.xml.transform.TransformerFactory", "org.apache.xalan.xsltc.trax.TransformerFactoryImpl"); and then set a couple of attributes as follows: transformerFactory.setAttribute("translet-name", convId); transformerFactory.setAttribute("destination-directory", "/uwc_base/dist/JDK1.4_DBG.OBJ/WEB-INF/lib"); transformerFactory.setAttribute("package-name", "com.blah.translets"); transformerFactory.setAttribute("jar-name", "iabs-translets.jar"); transformerFactory.setAttribute("generate-translet", Boolean.TRUE); transformerFactory.setAttribute("use-classpath", Boolean.TRUE); .... _templates = transformerFactory.newTemplates(new DOMSource(xslDoc)); Now, the "use-class" property = true, indicates that the the TransformerFactorty should expect a precompiled Translet (Java Class representation of XSL) at the ClassPath. For this I will have to make sure that the translet is generated before the application starts. If "use-class" property = false, the TransformerFactory will compile the XSL into translet on its own. I would like a way where XSLTranformerFactory determines on its own whether a Translet is already existing. If yes, it shoud use it, and if no it should generate it. Is there a way that can be done by setting some attribute of the factory, and without me having to write code to check the presence of the translet? I read from somewhere that setting the attribute "use-from-classpath" to true, accomplishes that, but looks like the XSLTC factory does not support that attribute. Thanks in advance, Gaurav