1 16 19 20 import javax.xml.transform.Templates ; 21 import javax.xml.transform.TransformerFactory ; 22 import javax.xml.transform.stream.StreamSource ; 23 24 public class Compile { 25 26 public static void main(String [] args){ 27 Compile app = new Compile(); 28 app.run(args[0]); 29 } 30 31 35 public void run(String xsl) { 36 try { 37 System.setProperty("javax.xml.transform.TransformerFactory", 39 "org.apache.xalan.xsltc.trax.TransformerFactoryImpl"); 40 41 StreamSource stylesheet = new StreamSource (xsl); 43 44 TransformerFactory factory = TransformerFactory.newInstance(); 47 factory.setAttribute("generate-translet", Boolean.TRUE); 48 Templates templates = factory.newTemplates(stylesheet); 49 } 50 catch (Exception e) { 51 System.err.println("Exception: " + e); 52 e.printStackTrace(); 53 } 54 System.exit(0); 55 } 56 57 private void usage() { 58 System.err.println("Usage: compile <xsl_file>"); 59 System.exit(1); 60 } 61 62 } 63 | Popular Tags |