File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes java xslt & output xml files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "java xslt & output xml files" Watch "java xslt & output xml files" New topic

java xslt & output xml files

manish ahuja
Ranch Hand

Joined: Oct 23, 2003
Posts: 312
Hi All,

Currently we are using the following java code to run the xslt & passing the appropriate input xml.
Now the xslt transformation is as such that for the input file it takes it returns multiple output xml files. So its like a xml to xml's transformation.

What we need to acheive is to capture these output xml files from xslt in our java code & do some further processing on the same.

Do post your suggestions on what would be an ideal way to go about the same.

Here is the java code for xslt

import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;

public class Transform {

public static void main(String[] args) throws Exception {
if (args.length != 2) {
"Usage: java Transform [xmlfile] [xsltfile]");

File xmlFile = new File(args[0]);
File xsltFile = new File(args[1]);

Source xmlSource = new StreamSource(xmlFile);
Source xsltSource = new StreamSource(xsltFile);

TransformerFactory transFact =
Transformer trans = transFact.newTransformer(xsltSource);

trans.transform(xmlSource, new StreamResult(System.out));


I agree. Here's the link:
subject: java xslt & output xml files
It's not a secret anymore!