Source Code : Set the TransformerFactory system property to generate and use translets
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Set the TransformerFactory system property to generate and use translets
import java.io.FileOutputStream;
import java.util.Properties;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
public class MainClass {
public static void main(String argv[]) throws Exception {
Properties props = System.getProperties();
props.put("javax.xml.transform.TransformerFactory",
"org.apache.xalan.xsltc.trax.TransformerFactoryImpl");
System.setProperties(props);
TransformerFactory tFactory = TransformerFactory.newInstance();
Templates translet = tFactory.newTemplates(new StreamSource(
"OrderProcessing.xslt"));
Transformer transformer = translet.newTransformer();
transformer.transform(new StreamSource("CustomerOrders.xml"),
new StreamResult(new FileOutputStream("SortedOrders.html")));
transformer.transform(new StreamSource("CustomerOrders1.xml"),
new StreamResult(new FileOutputStream("SortedOrders1.html")));
}
}
Thank with us