Transform XML into HTML using XSLT

Reference :

How to transfrom XML into HTML using XSLT in Java?

public String view() throws SQLException{

//get XML from database before do print

System.out.println(xmlData);  //This is the result when I take the XML from database using hibernate framework.

try {

File file = new File(“xmlFile.xml”);

FileWriter fileWriter = new FileWriter(file);




TransformerFactory tFactory = TransformerFactory.newInstance();

//We will transform xml into HTML using XSLT and save HTML file in local disk D

Transformer transformer = tFactory.newTransformer (

new“copy Path form1.XSL to here”));

transformer.transform( new,  new ( new FileOutputStream(“D:/formWithData.html”)));


catch (Exception e) {

e.printStackTrace( );





Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s