<br><font size=2 face="Courier New">I use the following which produces an xml output file from a JDOM document (called quote here).</font>
<br>
<br><font size=2 face="Courier New">The xsl contains the following</font>
<br>
<br><font size=3 color=blue face="Times New Roman"><</font><font size=3 color=#990000 face="Times New Roman">xsl:output</font><font size=3 face="Times New Roman"> </font><font size=3 color=#990000 face="Times New Roman">method</font><font size=3 color=blue face="Times New Roman">="</font><font size=3 face="Times New Roman"><b>xml</b></font><font size=3 color=blue face="Times New Roman">"</font><font size=3 color=#990000 face="Times New Roman"> encoding</font><font size=3 color=blue face="Times New Roman">="</font><font size=3 face="Times New Roman"><b>UTF-8</b></font><font size=3 color=blue face="Times New Roman">"</font><font size=3 color=#990000 face="Times New Roman"> standalone</font><font size=3 color=blue face="Times New Roman">="</font><font size=3 face="Times New Roman"><b>yes</b></font><font size=3 color=blue face="Times New Roman">"</font><font size=3 color=#990000 face="Times New Roman"> indent</font><font size=3 color=blue face="T!
imes New Roman">="</font><font size=3 face="Times New Roman"><b>yes</b></font><font size=3 color=blue face="Times New Roman">" /></font>
<br>
<br><font size=2 face="Courier New"> </font><font size=2 color=#4040c2 face="Courier New">/**</font>
<br><font size=2 face="Courier New"> </font><font size=2 color=#4040c2 face="Courier New">*</font><font size=2 face="Courier New"> </font><font size=2 color=#4040c2 face="Courier New">Produces</font><font size=2 face="Courier New"> </font><font size=2 color=#4040c2 face="Courier New">an</font><font size=2 face="Courier New"> </font><font size=2 color=#4040c2 face="Courier New">export</font><font size=2 face="Courier New"> </font><font size=2 color=#4040c2 face="Courier New">of</font><font size=2 face="Courier New"> </font><font size=2 color=#4040c2 face="Courier New">selected</font><font size=2 face="Courier New"> </font><font size=2 color=#4040c2 face="Courier New">data</font><font size=2 face="Courier New"> </font><font size=2 color=#4040c2 face="Courier New">from</font><font size=2 face="Courier New"> </font><font size=2 color=#4040c2 face="Courier New">the</font><font size=2 face="Courier New"> </font><font size=2 color=#4040c2 face="Cour!
ier New">quote</font><font size=2 face="Courier New"> </font><font size=2 color=#4040c2 face="Courier New">(JDOM</font><font size=2 face="Courier New"> </font><font size=2 color=#4040c2 face="Courier New">Document)</font>
<br><font size=2 face="Courier New"> </font><font size=2 color=#4040c2 face="Courier New">*</font><font size=2 face="Courier New"> </font><font size=2 color=#4040c2 face="Courier New">into</font><font size=2 face="Courier New"> </font><font size=2 color=#4040c2 face="Courier New">an</font><font size=2 face="Courier New"> </font><font size=2 color=#4040c2 face="Courier New">xml</font><font size=2 face="Courier New"> </font><font size=2 color=#4040c2 face="Courier New">file.</font>
<br><font size=2 face="Courier New"> </font><font size=2 color=#4040c2 face="Courier New">*/</font>
<br><font size=2 face="Courier New"> </font><font size=2 color=#820040 face="Courier New">public</font><font size=2 face="Courier New"> </font><font size=2 color=#820040 face="Courier New">void</font><font size=2 face="Courier New"> menuFileExport() {</font>
<br><font size=2 face="Courier New"> enableWaitCursor();</font>
<br><font size=2 face="Courier New"> </font>
<br><font size=2 face="Courier New"> Transformer transformer;</font>
<br><font size=2 face="Courier New"> FileOutputStream fos = </font><font size=2 color=#820040 face="Courier New">null</font><font size=2 face="Courier New">;</font>
<br>
<br><font size=2 face="Courier New"> </font><font size=2 color=#820040 face="Courier New">try</font><font size=2 face="Courier New"> {</font>
<br><font size=2 face="Courier New"> transformer =</font>
<br><font size=2 face="Courier New"> TransformerFactory.newInstance().newTransformer(</font>
<br><font size=2 face="Courier New"> </font><font size=2 color=#820040 face="Courier New">new</font><font size=2 face="Courier New"> javax.xml.transform.stream.StreamSource(</font>
<br><font size=2 face="Courier New"> Global.getRootDir() + </font><font size=2 color=#4200ff face="Courier New">"export.xsl"</font><font size=2 face="Courier New">));</font>
<br><font size=2 face="Courier New"> fos = </font><font size=2 color=#820040 face="Courier New">new</font><font size=2 face="Courier New"> FileOutputStream(Global.getReportsDir() + </font><font size=2 color=#4200ff face="Courier New">"export.xml"</font><font size=2 face="Courier New">);</font>
<br><font size=2 face="Courier New"> StreamResult out = </font><font size=2 color=#820040 face="Courier New">new</font><font size=2 face="Courier New"> StreamResult(fos);</font>
<br><font size=2 face="Courier New"> transformer.transform(</font><font size=2 color=#820040 face="Courier New">new</font><font size=2 face="Courier New"> JDOMSource(quote), out);</font>
<br><font size=2 face="Courier New"> fos.flush();</font>
<br><font size=2 face="Courier New"> fos.close();</font>
<br><font size=2 face="Courier New"> } </font><font size=2 color=#820040 face="Courier New">catch</font><font size=2 face="Courier New"> (Exception e) {</font>
<br><font size=2 face="Courier New"> Global.showErrorMessage(</font>
<br><font size=2 face="Courier New"> Utility.get(</font><font size=2 color=#4200ff face="Courier New">"DialogUnableToCreateReportMessage"</font><font size=2 face="Courier New">));</font>
<br><font size=2 face="Courier New"> } </font><font size=2 color=#820040 face="Courier New">finally</font><font size=2 face="Courier New"> {</font>
<br><font size=2 face="Courier New"> disableWaitCursor();</font>
<br><font size=2 face="Courier New"> }</font>
<br><font size=2 face="Courier New"> </font>
<br><font size=2 face="Courier New"> fos = </font><font size=2 color=#820040 face="Courier New">null</font><font size=2 face="Courier New">;</font>
<br><font size=2 face="Courier New"> transformer = </font><font size=2 color=#820040 face="Courier New">null</font><font size=2 face="Courier New">;</font>
<br><font size=2 face="Courier New"> }</font><font size=2 face="sans-serif"><br>
<br>
/Phill<br>
IS Dept, Software Engineer.<br>
phill_perryman@mitel.com<br>
http://www.mitel.com<br>
Tel: +44 1291 436023</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td>
<td><font size=1 face="sans-serif"><b>Salim Hamid <hamid@us.ibm.com></b></font>
<br><font size=1 face="sans-serif">Sent by: jdom-interest-admin@jdom.org</font>
<p><font size=1 face="sans-serif">18/05/2004 19:27</font>
<br>
<td><font size=1 face="Arial"> </font>
<br><font size=1 face="sans-serif"> To: jdom-interest@jdom.org, jdom-interest-admin@jdom.org</font>
<br><font size=1 face="sans-serif"> cc: </font>
<br><font size=1 face="sans-serif"> Subject: Re: FW: [jdom-interest] Question regarding XML transformation!</font></table>
<br>
<br>
<br><font size=2 face="sans-serif"><br>
Our XSL does not contain "</font><font size=2 color=blue face="Arial"><xsl:output method="text"/></font><font size=2 face="sans-serif">" but it does contain the following:</font><font size=3 face="Times New Roman"> <br>
</font><font size=2 face="sans-serif"><br>
<xsl:output method="xml" encoding="UTF-8" indent="yes"/> <br>
</font><font size=3 face="Times New Roman"><br>
<br>
<br>
</font>
<table width=100%>
<tr valign=top>
<td width=2%>
<td width=38%><font size=1 face="sans-serif"><b>"Robert Taylor" <rtaylor@mulework.com></b></font><font size=3 face="Times New Roman"> </font><font size=1 face="sans-serif"><br>
Sent by: jdom-interest-admin@jdom.org</font><font size=3 face="Times New Roman"> </font>
<p><font size=1 face="sans-serif">05/18/2004 01:54 PM</font><font size=3 face="Times New Roman"> </font>
<td width=59%><font size=1 face="Arial"> </font><font size=1 face="sans-serif"><br>
To: <jdom-interest@jdom.org></font><font size=3 face="Times New Roman"> </font><font size=1 face="sans-serif"><br>
cc: </font><font size=3 face="Times New Roman"> </font><font size=1 face="sans-serif"><br>
Subject: FW: [jdom-interest] Question regarding XML transformation!</font></table>
<br><font size=3 face="Times New Roman"><br>
<br>
</font><font size=2 color=blue face="Arial"><br>
I sent this directly to the recipient (by accident) instead of the list.</font><font size=3 face="Times New Roman"> <br>
</font><font size=2 color=blue face="Arial"><br>
robert</font><font size=3 face="Times New Roman"> </font><font size=2 face="Tahoma"><br>
-----Original Message-----<b><br>
From:</b> Robert Taylor [mailto:rtaylor@mulework.com]<b><br>
Sent:</b> Tuesday, May 18, 2004 1:27 PM<b><br>
To:</b> Salim Hamid<b><br>
Subject:</b> RE: [jdom-interest] Question regarding XML transformation!</font><font size=3 face="Times New Roman"><br>
</font><font size=2 color=blue face="Arial"><br>
This may or may not help, but I get the same exception when I have the following line in my XSL:</font><font size=3 face="Times New Roman"> <br>
</font><font size=2 color=blue face="Arial"><br>
<xsl:output method="text"/></font><font size=3 face="Times New Roman"> <br>
</font><font size=2 color=blue face="Arial"><br>
If I remove that line, then the exception is no longer thrown.</font><font size=3 face="Times New Roman"> <br>
</font><font size=2 color=blue face="Arial"><br>
hth,</font><font size=3 face="Times New Roman"> <br>
</font><font size=2 color=blue face="Arial"><br>
robert</font><font size=3 face="Times New Roman"> </font><font size=2 face="Tahoma"><br>
-----Original Message-----<b><br>
From:</b> jdom-interest-admin@jdom.org [mailto:jdom-interest-admin@jdom.org]<b>On Behalf Of </b>Salim Hamid<b><br>
Sent:</b> Tuesday, May 18, 2004 1:17 PM<b><br>
To:</b> jdom-interest@jdom.org<b><br>
Subject:</b> [jdom-interest] Question regarding XML transformation!</font><font size=3 face="Times New Roman"><br>
</font><font size=2 face="sans-serif"><br>
<br>
We've recently acquired Beta 10 release of JDOM and are interested in the new transformation classes. Do they support transforming an XML doc using an XSL file that I provide? I have the following code but I get the exception "<b>java.lang.IllegalStateException: Root element not set</b> " when I attempt to do anything with the transformed document:</font><font size=3 face="Times New Roman"> </font>
<br><font size=2 face="sans-serif"><br>
XSLTransformer transformer = new XSLTransformer(xslFileName);</font><font size=3 face="Times New Roman"> </font><font size=2 face="sans-serif"><br>
Document targetDoc = transformer.transform(sourceDoc);</font><font size=3 face="Times New Roman"> </font><font size=2 face="sans-serif"><br>
<br>
System.out.println(targetDoc); <b>// This line throws the exception indicating that the transformation did not occur correctly</b></font><font size=3 face="Times New Roman"> </font><font size=2 face="sans-serif"><br>
<br>
The XML doc is transformed fine using the XMLTransformer class provided by IBM WebSphere. Unfortunately, the WebSphere class only deals with files-- something that we don't want due to I/O processing. We want to transform XML strings instead of files. Am I not understanding something about the JDOM transformation classes or are there future plans to support what we want?</font><font size=3 face="Times New Roman"> </font><font size=2 face="sans-serif"><br>
<br>
A reply to this note would be greatly appreciated.</font><font size=3 face="Times New Roman"> </font><font size=2 face="sans-serif"><br>
<br>
Regards,<br>
<br>
Salim Hamid<br>
IBM Software Group -- Digital Media Development<br>
301-803-1247 T/L 262-1247</font><font size=3 face="Times New Roman"> </font>
<br>
<br>