Thanks. On my current build it was crashing rather than returning empty output - the code has changed a little bit. I've now fixed this particular problem, so it should be OK in future. I don't have time right now to reproduce it and develop a patch for 8.4 as released, sorry.
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Ravi Kollu
Sent: 14 June 2005 15:44
To: saxon-help@lists.sourceforge.net
Subject: RE: [saxon] Serialization of an unattched Element

I am using javax.xml.transform.TransformerFactory to create a Transformer without XSLT or XQuery instructions. Following is a code snippet in which keyInfo is an Element object.
 
StringWriter sw = new StringWriter();
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.transform(new DOMSource(keyInfo), new StreamResult(sw));
sw.close();
System.out.println(sw.toString());
 
 
Ravi


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Michael Kay
Sent: Monday, June 13, 2005 6:35 PM
To: saxon-help@lists.sourceforge.net
Subject: RE: [saxon] Serialization of an unattched Element

Could you tell me how you are invoking the serialization? (I assume this is XQuery rather than XSLT, you don't say).
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Ravi Kollu
Sent: 13 June 2005 18:46
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Serialization of an unattched Element

Hello,
When an Element that is not part of a document is serialized, only the processing instruction "<?xml version="1.0" encoding="UTF-8"?>" is getting written to the StreamResult. Where as if the element is append to a document and then serialized, it is getting serialized completely. Does any one know why?

Thanks
--Ravi