-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathXSLTTransform.java
21 lines (16 loc) · 977 Bytes
/
XSLTTransform.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import javax.xml.transform.stream.StreamSource; import javax.xml.transform.Result;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.Source;
import javax.xml.transform.TransformerFactory; import java.io.File;
import javax.xml.transform.Transformer;
public class XSLTTransform {
public static void main(final String argv[]) throws Throwable {
TransformerFactory factory; Transformer transformer;
Source xmlInput, xsltInput; Result output;
xmlInput = new StreamSource(new File("../xml/courseWithNamespace.xml"));
xsltInput = new StreamSource(new File("../xml/courses2html.xslt"));
output = new StreamResult(System.out);
factory = TransformerFactory.newInstance(); // create the necessary objects to
transformer = factory.newTransformer(xsltInput); // transform an XML stream with XSLT!
transformer.transform(xmlInput, output); // flush the data
}
}