Hello,
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:
TransformerFact ory tFactory =
TransformerFact ory.newInstance ();
Transformer transformer = tFactory.newTra nsformer(new
StreamSource(Xs lFileName));
transformer.set OutputProperty( OutputKeys.ENCO DING,
"UTF-8");
transformer.set OutputProperty( OutputKeys.INDE NT, "yes");
transformer.set OutputProperty( OutputKeys.METH OD, "html");
transformer.tra nsform(new DOMSource(m_Roo t), new
StreamResult(ou t));
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
do************* *@eolya.fr