Thanks again Michael
I tried to serialize the templates object and I get: com.icl.saxon.PreparedStyleSheet
 void com.tcs.wireless.Prueba.main(java.lang.String[])
I'm working right now with 6.5.3.
Néstor Boscán

De: [] En nombre de Michael Kay
Enviado el: Saturday, January 31, 2004 6:43 AM
Asunto: RE: [saxon] Examples on how to serialize a Templates object?

You can create and serialize the Templates object using the net.sf.saxon.Compile command from the command line; if you want to do it from the API, take a look at the source code for this command to see how it works. It's essentially:
Templates sheet = factory.newTemplates(styleSource);
ObjectOutputStream oos = new ObjectOutputStream(
                                             new FileOutputStream(outputFileName));
To load it back into memory, you can use the -c option on the net.sf.saxon.Transform command, or again you can do it from your application. The only tricky thing is that you have to make sure the NamePool that was used when compiling the stylesheet is also used when running it:
                        ObjectInputStream ois = new ObjectInputStream(new FileInputStream(styleFileName));
                        Templates sheet = (Templates)ois.readObject();
Don't expect vast savings from this. A compiled stylesheet, when serialized, occupies more space on disk than the original source XML stylesheet, and this means it's not all that much faster to read the compiled stylesheet in from disk than it is to recompile the original. If you make any performance measurements, I would be interested to see them.
Michael Kay
-----Original Message-----
From: [] On Behalf Of Nestor Boscan
Sent: 30 January 2004 23:21
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