Transforming html file in java
<pre><code>public String transform_XML(String type, InputStream file){
        TransformerFactory tf = TransformerFactory.newInstance();
        String xslfile = "/StyleSheets/" + type + ".xsl";
        Transformer t = tf.newTemplates(new StreamSource(this.getClass().getResourceAsStream(xslfile))).newTransformer();
        Source source = new StreamSource(file);
        CharArrayWriter wr = new CharArrayWriter();
        StreamResult result = new StreamResult(wr);
        t.transform(source, result);
     return wr.toString();
}
</code></pre>

<p>The above method takes an xsl and xml file as input and returns the transformed result as String. Classes from Package javax.xml.transform has been used to accomplish this.</p>

<p>Now can i use the same package to transform an html file? (Since the package name has xml i seriously doubt it.) What should i do to transform an html file?</p>
