Suggested Pages

Wednesday, January 18, 2017

Simple XSLT Transformation

XSLT Transformation

...

import java.io.File;
import java.io.FileOutputStream;
import java.net.MalformedURLException;

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

import org.xml.sax.SAXException;


public class SampleXSLT {
 

 public void transform(String input, String output,String xsltPath){
      ...
     TransformerFactory tFactory = TransformerFactory.newInstance();
     Transformer transformer = tFactory.newTransformer(new StreamSource(xsltPath));
     transformer.transform(new StreamSource(input), new StreamResult(new FileOutputStream(output)));
      ...
}


No comments :

Post a Comment

Suggested Pages