Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Java XSLT Tranformer: DOMSource vs. StreamSource problem

Thread Tools

Java XSLT Tranformer: DOMSource vs. StreamSource problem

Dominique Bejean
Posts: n/a

I am having a problem doing an XSLT transformation using Java.

I have a XML document as a DOM Document object, wrap the Document
object with a DOMSource object, and do the transformation. However,
the transformation does not work. None of the templates in the XSLT
source are Matched, except for the root template.
The code is as follows:

TransformerFactory tFactory =
Transformer transformer = tFactory.newTransformer(new

transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.METHOD, "html");

transformer.transform(new DOMSource(m_Root), new

I discovered that if I transform the DOM Document object back into
text and wrap the text in a StreamSource, then the transformation
works fine. It does not make sense that the StreamSource approach
works and the DOMSource approach does not.

I use JDK 1.4.2, Xerces 2.5.0 and Xalan 2.5.2

Can anybody explain what the problem may be?

Thank you for your help.

Dominique Bejean Removed)
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
EOFException when reading in streamSource from String jwasp Java 0 05-08-2009 10:58 PM
trax, and transforms from a DOMSource Simon Brooke XML 2 03-15-2007 10:38 PM
ANN: New low-cost XML Editor, XSLT Editor, XSLT Debugger, DTD/Schema Editor Stylus Studio Java 0 08-03-2004 03:53 PM
xslt alone or xslt/java for static site? ted XML 1 01-26-2004 10:41 AM
Java XSLT Tranformer: DOMSource vs. StreamSource problem Dominique Bejean XML 0 12-22-2003 03:35 PM