Title: 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