FileDocCategorySizeDatePackage
JAXPTransform.javaAPI DocExample940Sun Mar 14 10:53:04 GMT 2004None

JAXPTransform

public class JAXPTransform extends Object
Illustrate simplest use of JAXP to transform using XSL
param
args three filenames: XML, XSL, and Output (this order is historical).

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

		
		// Require three input args
		if (args.length != 3) {
			System.out.println("Usage: java JAXPTransform inputFile.xml inputFile.xsl outputFile");
			System.exit(1);
		}
		
		// Create a transformer object
		Transformer tx = TransformerFactory.newInstance().newTransformer(
				new StreamSource(new File(args[1]))); // not 0
		
		// Use its transform() method to perform the transformation
		tx.transform(new StreamSource(new File(args[0])), // not 1
				new StreamResult(new File(args[2])));