import javax.xml.transform.*;
import javax.xml.transform.stream.*;
public class XSLTTest {
public static void main(String[] args) {
// xml,xsl ve html dosyası tanımlanıyor.
String xml = "D:\\students.xml";
String xsl = "D:\\StudentsToHtml.xsl";
String html = "D:\\students_output.html";
try {
TransformerFactory transformFactory = TransformerFactory.newInstance();
// xsl kaynağı yaratılıyor.
StreamSource xslSource = new StreamSource(xsl);
Transformer transformer = transformFactory.newTransformer(xslSource);
StreamSource xmlSource = new StreamSource(xml);
StreamResult result = new StreamResult(html);
// xml html’e dönüştürülüyor.
transformer.transform(xmlSource, result);
System.out.println("xml html'e çevrildi.");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Dosyayı İndir