Source for Transforming org.w3c.dom.Node : XSLTProcessor « XML « Java Tutorial






import org.xml.sax.SAXException;
import org.apache.xalan.xslt.XSLTProcessorFactory;
import org.apache.xalan.xslt.XSLTInputSource;
import org.apache.xalan.xslt.XSLTResultTarget;
import org.apache.xalan.xslt.XSLTProcessor;

import org.w3c.dom.Document;
import org.apache.xerces.parsers.DOMParser;

import java.io.FileOutputStream;

public class xalantransformNode {
  public static void main(String[] args) throws java.io.IOException,
      java.net.MalformedURLException, org.xml.sax.SAXException {

    XSLTProcessor processor = XSLTProcessorFactory.getProcessor();

    DOMParser parser = new DOMParser();
    parser.parse(args[0]);

    Document dom = parser.getDocument();

    processor.process(new XSLTInputSource(dom), new XSLTInputSource(args[1]), new XSLTResultTarget(
        new FileOutputStream(args[2])));
  }
}








33.17.XSLTProcessor
33.17.1.Source for Transformation Application
33.17.2.Source for Transforming org.w3c.dom.Node