Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;

public class Main {
    public static void main(String[] args) throws Exception {
        Source xslSource = new StreamSource(Main.class.getResourceAsStream("test.xsl"));
        Source xmlSource = new StreamSource(Main.class.getResourceAsStream("test.xml"));

        Transformer transf = TransformerFactory.newInstance().newTransformer(xslSource);

        StreamResult transformedXml = new StreamResult(System.out);
        transf.transform(xmlSource, transformedXml);
    }
}