java xml转换成html,java 使用xslt将xml文件转换成html,xsltxml,如下是要转换的xml文件...

java 使用xslt将xml文件转换成html,xsltxml,如下是要转换的xml文件

如下是要转换的xml文件howto.xml示例:Javahttp://byrx.net/code-snippet/tagged/javaPythonhttp://byrx.net/code-snippet/tagged/pythonJavascripthttp://byrx.net/code-snippet/tagged/javascriptVBScripthttp://byrx.net/code-snippet/tagged/VBScript

示例xslt文件[howto.xsl]Real's HowTo

Title URL

做转换的java代码:import javax.xml.transform.*;import java.net.*;import java.io.*;public class HowToXSLT {public static void main(String[] args) { try { TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer (new javax.xml.transform.stream.StreamSource ("howto.xsl")); transformer.transform (new javax.xml.transform.stream.StreamSource ("howto.xml"), new javax.xml.transform.stream.StreamResult ( new FileOutputStream("howto.html"))); } catch (Exception e) { e.printStackTrace( ); } }}

你可能感兴趣的:(java,xml转换成html)