Java/XML/xalan

Материал из Java эксперт
Перейти к: навигация, поиск

Source Update to Handle Stylesheet Parameters

 
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 java.io.FileOutputStream;
public class MainClass {
  public static void main(String[] args) throws java.io.IOException,
      java.net.MalformedURLException, org.xml.sax.SAXException {
    XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
    processor.setStylesheetParam("greeting", ""Hello Mike"");
    processor.process(new XSLTInputSource(args[0]), new XSLTInputSource(args[1]),
        new XSLTResultTarget(new FileOutputStream(args[2])));
  }
}