Hi,

I could not find anything wrong with auto-translet using Xalan 2.7.0.  The only thing that seems to cause it to misbehave is if the time on the two systems is out of sync.  Could you give more details as to what is going wrong (e.g. you changed the source but it doesn't recompile), and how you have the two systems set up (how does the first system access the source on the second system)?

Thanks.


Erin Harris




<[EMAIL PROTECTED]>

11/25/2005 10:11 AM

To
<[email protected]>
cc
<[EMAIL PROTECTED]>
Subject
auto-translet





Hi,

We're using Xalan 2.6.0, xsltc.

Regarding following codesnippet:

TransformerFactory transFact = TransformerFactory.newInstance();

transFact.setAttribute("generate-translet", Boolean.TRUE);
transFact.setAttribute(
"auto-translet", Boolean.TRUE);
transFact.setAttribute(
"package-name", "uniquepackagename));
transFact.setAttribute(
"destination-directory", templateLocation);

Source source = new StreamSource(xslUri.toExternalForm());
source.setSystemId(xslUri.toExternalForm());

templates = transFact.newTemplates(source);

One issue with stylesheets coming from different directories & bearing the same name has been solved by passing a unique packagename to the 'package-name' attribute.

However, another issue popped up: it seems the auto-translet isn't working like it should. Compiled stylesheets & source are physically located on different machines. It seems the call made to getStylesheetFileName from getBytecodesFromClasses is where the problem lies:

    private String getStylesheetFileName(Source source)
   {

       String systemId = source.getSystemId();

     
 if (systemId != null) {
           File file =
new File(systemId);
         
 if (file.exists())
             
 return systemId;
         
 else {
               URL url =""> null;
             
 try {
                   url =""> new URL(systemId);
               }

             
 catch (MalformedURLException e) {
                 
 return null;
               }

         
             
 if ("file".equals(url.getProtocol()))
                 
 return url.getFile();
             
 else
                 
 return null;
           }

       }

     
 else
         
 return null;
   }

In our base & unit tests this return null when compiled stylesheets and source are located on different systems.

Anyone having a suggestion or confirmation?

Greetings,

Robert

Reply via email to