Hello. I have the following code with transforms a xml with xslt and sends the result to System.Out...
I would like the result of the transformation to end up in a DOM object so I can post it to a WebService. Any help is appreciated.
Alex-
Code:
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.Source;
import javax.xml.transform.Result;
import javax.xml.transform.OutputKeys;
public class XMLwithXSLT
{
public static void main(String[] args) throws Exception
{
Source source = new StreamSource("Document2.xml");
Source xsl = new StreamSource("newstylesheet1.xsl");
Result result = new StreamResult(System.out);
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(xsl);
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.transform(source, result);
}
}
I would like the result of the transformation to end up in a DOM object so I can post it to a WebService. Any help is appreciated.
Alex-