Changeset 19339
- Timestamp:
- 2009-05-06T14:54:14+12:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
documentation/trunk/shared/ApplyXSLT.java
r13885 r19339 46 46 static public void main(String[] args) 47 47 { 48 if (args.length < 2) {49 System.err.println("Usage: ApplyXSLT < XSLfile> <XMLfile> <GSDLHOME>");48 if (args.length < 3) { 49 System.err.println("Usage: ApplyXSLT <Target_language_code> <XSLfile> <XMLfile>"); 50 50 System.exit(1); 51 } 51 } 52 52 53 53 System.setProperty("javax.xml.transform.TransformerFactory", 54 54 "org.apache.xalan.processor.TransformerFactoryImpl"); 55 if (args.length == 3){56 System.setProperty("GSDLHOME",args[ 2]);55 if (args.length == 4){ 56 System.setProperty("GSDLHOME",args[3]); 57 57 } 58 58 … … 61 61 t_factory = org.apache.xalan.processor.TransformerFactoryImpl.newInstance(); 62 62 } 63 catch (Exception ex) { 63 catch (Exception ex) { 64 64 System.err.println("XMLTransformer() exception " + ex.getMessage()); 65 65 System.exit(1); 66 66 } 67 67 68 String stylesheet = args[0]; 69 String xml_in = args[1]; 68 String lang = args[0]; 69 String stylesheet = args[1]; 70 String xml_in = args[2]; 70 71 try { 71 72 // Use the TransformerFactory to process the stylesheet Source and generate a Transformer … … 75 76 StreamSource input = (xml_in.equals("-") ? new StreamSource(System.in) : new StreamSource(xml_in)); 76 77 OutputStreamWriter output = new OutputStreamWriter(System.out, "UTF-8"); 78 79 transformer.setParameter("lang", lang); 77 80 transformer.transform(input, new StreamResult(output)); 78 81 }
Note:
See TracChangeset
for help on using the changeset viewer.