First question is: is Saxon actually being invoked? Your message suggests that you think it is, but are you sure?
You say it "doesn't give you a result". That could be for all sorts of reasons: for example, the variable "type" might not be equal to "XLS". Sorry if that sounds as if I'm giving you very little credit, but when you're debugging code, your own or anyone else's, you have to eliminate the obvious things first, and the trouble is, you haven't provided enough information to enable me to do that.
Does it work if you remove the Apache serializer from the equation?
I suggest you try to create a complete program, that I can run for myself, preferably without any dependencies on third-party software. This should help us to eliminate most of the possible causes of the problem.
Incidentally, creating a DOM merely in order to transform it using Saxon is very inefficient. I think this is also true of Xalan. It's much better to supply a StreamSource and let Saxon build its own internal tree representation, which takes much less memory and is optimized for operations such as sorting nodes into document order.
With any kind of Source object it's a good idea to call setSystemId() to establish a base URI. However, not doing so will only cause problems if the stylesheet does some operation that requires knowledge of the base URI, for example a call to document().
Is saxon8-dom.jar on the classpath? You need it if you are using DOM interfaces. However, if it wasn't there I would expect an exception, rather than "no result". But then, you haven't shown enough code for me to see what would happen to an exception if it were thrown.
Michael Kay

From: [] On Behalf Of
Sent: 05 April 2006 08:41
Subject: [saxon] Using Saxon instead of Xalan

Hi, I send the email one again, as the first one didn't went through.

I cant't figure out how to get Saxon8 to work instead of Xalan. The code below works fine with Xalan but doesn't give me a result
with Saxon. Can you please help me to get this working with Saxon8.
Got it working while having a local file, tried different things to apply an SystemId, but couldn't figure out if this is the problem.

/Christoph out = new;

javax.xml.parsers.DocumentBuilderFactory dFactory
        = javax.xml.parsers.DocumentBuilderFactory.newInstance();

DocumentBuilder dBuilder = dFactory.newDocumentBuilder();
Document xmlDoc = dBuilder.parse(new InputSource(new StringBufferInputStream(xml)));  
DOMSource xmlDomSource = new DOMSource(xmlDoc);

Document xslDoc = dBuilder.parse(new InputSource(new StringBufferInputStream(xsl)));
DOMSource xslDomSource = new DOMSource(xslDoc);

TransformerFactory tFactory
         = TransformerFactory.newInstance();
Templates templates = tFactory.newTemplates(xslDomSource);
Transformer transformer = templates.newTransformer();

if ("XLS".equalsIgnoreCase(type))
    /*--------- HSSF-only  Code ---------------------------------------------------------------*/
    // Set up the HSSF Serializer to serialize the Result to an output stream.
    org.apache.cocoon.serialization.HSSFSerializer ser
         = new org.apache.cocoon.serialization.HSSFSerializer();
    ser.initialize();  // don't forget this line or you get a null pointer exception
    // The Serializer functions as a SAX ContentHandler.
    Result result
       = new SAXResult((org.xml.sax.ContentHandler)ser);

transformer.transform(xmlDomSource, result);


byte[] content = out.toByteArray();
// pipeline
pipelineCursor = pipeline.getCursor();
IDataUtil.put( pipelineCursor, "content", content );

This message and any attachment ("the Message") are confidential. If you are not the intended recipient any use is strictly prohibited. If you have received the Message in error, please notify the sender immediately and delete the Message from your system, any use is forbidden. Correspondence via e-mail is primarily for information purposes. KAG/RVG/RIFA/ImmoKAG neither makes nor accepts legally binding statements unless otherwise agreed to the contrary