private void transform_xml()
{
try
{
Document document=read("e:/article.xml");
TransformerFactory factory=TransformerFactory.newInstance();
Transformer transformer=factory.newTransformer(new StreamSource("e:/text.xsl"));
DocumentSource source=new DocumentSource(document);
javax.xml.transform.stream.StreamResult result=new StreamResult(new FileOutputStream("e:/output.xml"));
transformer.transform(source,result);

}catch(TransformerException ex){}
catch(MalformedURLException ex){}
catch(DocumentException ex){}
catch(FileNotFoundException ex){}
}
上面是我以前写的一个把xml按照xslt样式转换的方法 参考一下用xslt转换xml的 那个stylesheet参数就是xslt文件的路径
用xslt可以把xml转换为html的