Hi I'm trying to use a dom4j tree as input for a XSLT transformation in SAXON
We have an existing web application in production using much Xerces and Xalan code. We are having problems with response times at times > 2 secs. Doing simple profiling shows that a lot of the time is spend at XSLT transforms. I therefore decided to replace Xalan and optional Xerces to get the relative easy improvements by changing packages. First I tried using Xalan and SAXON to transform a DOM, but this broke the id() function in XSLT (which we use a lot). According to Michael Kay it's because SAXON doesn't work well with DOM. Next I tried to replace DOM with DOM4J and using the example from the dom4j cookbook, but still the id() function was broken. Next I tried to use the SAXWriter functionality to create a SAX input for SAXON. I use the following code: public void doTransform(org.dom4j.io.DocumentSource docSource, javax.xml.transform.Transformer transformer, Writer pResultWriter { transformer.setParameter("xxx", "yyy"); transformer.setParameter("zzz", "www"); org.dom4j.io.SAXWriter writer = new org.dom4j.io.SAXWriter(); org.dom4j.io.DocumentInputSource docInputSource = new org.dom4j.io.DocumentInputSource(docSource.getDocument()) javax.xml.transform.sax.SAXSource source = new javax.xml.sax.SAXSource((org.xml.sax.XMLReader) writer, docInputSource); javax.xml.transform.stream.StreamResult result = new javax.xml.transform.stream.StreamResult(pResultWriter); transformer.transform(source, result); } According to the API doc for SAXSource it takes a XMLReader (here a XMLWriter) and a InputSource and calls XMLReader.parse(InputSource). Reading the API doc for SAXWriter it will only accept a parse(InputSource) if the InputSource is of type DocumentInputSource. I found it in org.dom4j.io but the DocumentInputSource was default not public. After making the class public the above code worked, but the id() function was still broken....... Does anyone know how to get a DOM representation into SAXON with the id() function working?? Is the only way to serialize the DOM and reparse it?? Does anyone have experience with using dom4j and Xalan and whether the id() function works in that configuration.. Looking through the source code for the JDOM adapter for SAXON shows that the id() function might work with it. (It has some Id handling functions). Does anyone have any experience with the JDOM Adapter and id() function. Is anyone working on a DOM4J adapter?? /Christian Bjørnbak ------------------------------------------------------- This sf.net email is sponsored by: Dice - The leading online job board for high-tech professionals. Search and apply for tech jobs today! http://seeker.dice.com/seeker.epl?rel_code1 _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user