>>  The CLASSPATH could be extended programmatically inside the Process
class;
>> there's no need for the user to speficy that.
We can record this item as something for future improvement.

>> If I understood Bruno correctly, the reason is that the Translet is
inside
>> a JAR; this is why, in my view, using CLASSPATH fits better in the JRE
>> model.
Resolving a translet from a jar file is already supported. You need to set
the "jar-name" attribute from Trax, or use the -XJ option from the Process
command line.

Suppose that you have a jar file named translets.jar located in c:\jars,
which contains an entry org/test/MyTranslet.class you want to use as a
translet. You can do the following:

TransformerFactory tf;
tf.setAttribute("destination-directory", "c:\\jars");
tf.setAttribute("jar-name", "translets.jar");
tf.setAttribute("package-name", "org.test");
tf.setAttribute("translet-name", "MyTranslet");
tf.setAttribute("auto-translet", "true");

Then the call tf.newTemplates() will use the class org.test.MyTranslet
inside the jar file to create the translet.


Morris Kwan
XSLT Development
IBM Toronto Lab
Tel: (905)413-3729
Email: [EMAIL PROTECTED]



                                                                                
                                                         
                      "Santiago                                                 
                                                         
                      Pericas-Geertsen"              To:       Morris 
Kwan/Toronto/[EMAIL PROTECTED]                                             
                      <Santiago.PericasGeerts        cc:       "Verachten 
Bruno" <[EMAIL PROTECTED]>,                       
                      [EMAIL PROTECTED]>                     <[EMAIL 
PROTECTED]>                                                     
                                                     Subject:  Re: How to set a 
URIResolver on a translet?                               
                      12/12/2002 02:15 PM                                       
                                                         
                                                                                
                                                         
                                                                                
                                                         



From: <[EMAIL PROTECTED]>

> Suppose that you want to run the following command:
> % java org.apache.xalan.xslt.Process -in subdir1/subsir2/test.xml -xsl
> subdir1/subdir2/test.xsl  -xsltc  -xt
>
> This command will use the translet to do the transformation if it exists
in
> the subsir1/subdir2 directory. You don't need to add subdir1/subdir2 to
the
> CLASSPATH before using the translet.

 The CLASSPATH could be extended programmatically inside the Process class;
there's no need for the user to speficy that.

> Also I don't understand why setting the destination-directory does not
work
> for this example.

 If I understood Bruno correctly, the reason is that the Translet is inside
a JAR; this is why, in my view, using CLASSPATH fits better in the JRE
model.

-- Santiago




Reply via email to