Resending. I did not get any response :-(
Thanks for your help in advance!

Gaurav

Gaurav wrote:
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






--
email_sig Gaurav Gandhi <[EMAIL PROTECTED]>
Sun Microsystems, Inc.




Reply via email to