Hi Brett
That is exactly what I'm doing now, also adding encryption to the stylesheet, but it is much better to have a compiled XSL . This way the source XSL is not in disk nor memory.
Néstor Boscán
 [mailto:saxon-help-admin@lists.sourceforge.net] En nombre de Brett Knights
Enviado el: Saturday, January 31, 2004 2:38 PM
Para: saxon-help@lists.sourceforge.net
Asunto: Re: [saxon] Examples on how to serialize a Templates object?

Why don't you just include the stylesheet as a resource. You have to deliver something and you could easily include the stylesheet itself at the top level of your jar file. Then you can get a stylesheet from code by creating an input stream.
InputStream in = this.getClass().getResourceAsStream("/myxsl.xsl");
StreamSource src = new StreamSource(in);
Template t = TransformerFactory ...
Of course if you have includes and imports you can do the same trick but create a URIResolver
TransformerFactory fact = TransformerFactory.newInstance();
final Class ref = this.getClass();
fact.setURIResolver (
    new URIResolver(){
        public Source resolve(String href, String base) throws TransformerException{
              InputStream in = ref.getResourceAsStream(href);
              if(in == null) return null;
              StreamSource src = new StreamSource(in);
              return src;
(Above is example only. It needs error handling etc. All stylesheet hrefs need to start with / and must be available at the top of a classpath reference.)
The nice thing about this is that if a customer has a problem with a stylesheet you can easily send them a fixed stylesheet and have them put it in a classpath location where it would be found before the stylesheets packaged with your jar.
----- Original Message -----
From: Nestor Boscan
To: saxon-help@lists.sourceforge.net
Sent: Friday, January 30, 2004 3:20 PM
Subject: [saxon] Examples on how to serialize a Templates object?

I would like to serialize the XSL Templates object so I can load it directly to memory in an application and not provide the XSL document. Is there a way to do this?. Any examples?
Néstor Boscán