<br><font size=2 face="sans-serif">Hello. Just FYI.... The reason
the transformation was not working is because my XML contained the tag
<b><xsl:text></b>. Apparently, it is not yet supported by Java
1.4.2 transformation. I would have at least expected an exception.
If it is intended to be supported, then I assume it is a bug. Thanks
to everyone who responded.</font>
<br><font size=2 face="sans-serif"><br>
Regards,<br>
<br>
Salim Hamid<br>
IBM Software Group -- Digital Media Development<br>
301-803-1247 T/L 262-1247<br>
</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td>
<td><font size=1 face="sans-serif"><b>Phill_Perryman@Mitel.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">05/19/2004 05:18 AM</font>
<td><font size=1 face="Arial"> </font>
<br><font size=1 face="sans-serif"> To:
jdom-interest@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="Courier New"><br>
I use the following which produces an xml output file from a JDOM document
(called quote here).</font><font size=3> <br>
</font><font size=2 face="Courier New"><br>
The xsl contains the following</font><font size=3> <br>
</font><font size=3 color=blue face="Times New Roman"><br>
<</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>="</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> <br>
</font><font size=2 face="Courier New"><br>
</font><font size=2 color=#4040c2 face="Courier New">/**</font><font size=3>
</font><font size=2 face="Courier New"><br>
</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>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><font size=3>
</font><font size=2 face="Courier New"><br>
</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><font size=3>
</font><font size=2 face="Courier New"><br>
</font><font size=2 color=#4040c2 face="Courier New">*/</font><font size=3>
</font><font size=2 face="Courier New"><br>
</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><font size=3> </font><font size=2 face="Courier New"><br>
enableWaitCursor();</font><font size=3>
</font><font size=2 face="Courier New"><br>
<br>
Transformer transformer;</font><font size=3>
</font><font size=2 face="Courier New"><br>
FileOutputStream
fos = </font><font size=2 color=#820040 face="Courier New">null</font><font size=2 face="Courier New">;</font><font size=3>
<br>
</font><font size=2 face="Courier New"><br>
</font><font size=2 color=#820040 face="Courier New">try</font><font size=2 face="Courier New">
{</font><font size=3> </font><font size=2 face="Courier New"><br>
transformer =</font><font size=3> </font><font size=2 face="Courier New"><br>
TransformerFactory.newInstance().newTransformer(</font><font size=3>
</font><font size=2 face="Courier New"><br>
</font><font size=2 color=#820040 face="Courier New">new</font><font size=2 face="Courier New">
javax.xml.transform.stream.StreamSource(</font><font size=3> </font><font size=2 face="Courier New"><br>
Global.getRootDir() + </font><font size=2 color=#4200ff face="Courier New">"export.xsl"</font><font size=2 face="Courier New">));</font><font size=3>
</font><font size=2 face="Courier New"><br>
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><font size=3>
</font><font size=2 face="Courier New"><br>
StreamResult out = </font><font size=2 color=#820040 face="Courier New">new</font><font size=2 face="Courier New">
StreamResult(fos);</font><font size=3> </font><font size=2 face="Courier New"><br>
transformer.transform(</font><font size=2 color=#820040 face="Courier New">new</font><font size=2 face="Courier New">
JDOMSource(quote), out);</font><font size=3> </font><font size=2 face="Courier New"><br>
fos.flush();</font><font size=3> </font><font size=2 face="Courier New"><br>
fos.close();</font><font size=3> </font><font size=2 face="Courier New"><br>
} </font><font size=2 color=#820040 face="Courier New">catch</font><font size=2 face="Courier New">
(Exception e) {</font><font size=3> </font><font size=2 face="Courier New"><br>
Global.showErrorMessage(</font><font size=3> </font><font size=2 face="Courier New"><br>
Utility.get(</font><font size=2 color=#4200ff face="Courier New">"DialogUnableToCreateReportMessage"</font><font size=2 face="Courier New">));</font><font size=3>
</font><font size=2 face="Courier New"><br>
} </font><font size=2 color=#820040 face="Courier New">finally</font><font size=2 face="Courier New">
{</font><font size=3> </font><font size=2 face="Courier New"><br>
disableWaitCursor();</font><font size=3> </font><font size=2 face="Courier New"><br>
}</font><font size=3>
</font><font size=2 face="Courier New"><br>
<br>
fos = </font><font size=2 color=#820040 face="Courier New">null</font><font size=2 face="Courier New">;</font><font size=3>
</font><font size=2 face="Courier New"><br>
transformer = </font><font size=2 color=#820040 face="Courier New">null</font><font size=2 face="Courier New">;</font><font size=3>
</font><font size=2 face="Courier New"><br>
}</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><font size=3> <br>
<br>
</font>
<table width=100%>
<tr valign=top>
<td width=2%>
<td width=33%><font size=1 face="sans-serif"><b>Salim Hamid <hamid@us.ibm.com></b></font><font size=3>
</font><font size=1 face="sans-serif"><br>
Sent by: jdom-interest-admin@jdom.org</font><font size=3> </font>
<p><font size=1 face="sans-serif">18/05/2004 19:27</font><font size=3>
</font>
<td width=63%><font size=1 face="Arial"> </font><font size=1 face="sans-serif"><br>
To: jdom-interest@jdom.org,
jdom-interest-admin@jdom.org</font><font size=3> </font><font size=1 face="sans-serif"><br>
cc: </font><font size=3>
</font><font size=1 face="sans-serif"><br>
Subject: Re: FW:
[jdom-interest] Question regarding XML transformation!</font></table>
<br><font size=3><br>
<br>
</font><font size=2 face="sans-serif"><br>
<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">
</font><font size=2 face="sans-serif"><br>
<br>
<xsl:output method="xml" encoding="UTF-8"
indent="yes"/> </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=58%><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>
<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=2 color=blue face="Arial"><br>
<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=2 face="sans-serif"><br>
<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><font size=2 face="sans-serif"><br>
<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><font size=3><br>
</font>
<br>