xsl+xml 生成 html的页面怎么变形了?
如题。
用的div+css布局。
我的生成代码是这么写的:
try {
StreamSource xmlSource = new StreamSource("D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/Model/xml/listNews1.xml");
StreamSource xsl = new StreamSource("D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/Model/xml/newsList.xsl");
Result outputTarget = new StreamResult("f:/jsp/MyHtml.html");
Transformer ts = TransformerFactory.newInstance().newTransformer(xsl);
ts.transform(xmlSource, outputTarget);
} catch (TransformerConfigurationException e) {
e.printStackTrace();
} catch (TransformerFactoryConfigurationError e) {
e.printStackTrace();
} catch (TransformerException e) {
e.printStackTrace();
}
最后怎么生成出来的html都变形了?
[解决办法]
在你的xml中输入xsl的地址.就可以看到最终的结果.大致象这样:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>