aspose file tools*
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


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "java xslt & output xml files" Watch "java xslt & output xml files" New topic
Author

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;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import java.io.*;

public class Transform {

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

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

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

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

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

-------------------------------------


Regards,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java xslt & output xml files