请问高手们一个关于Servlet和xml的一个问题!!!~~~~~
现在我有一个xml
aaa.xml
<?xml version= "1.0 " encoding= "UTF-8 "?>
<?xml-stylesheet type= "text/xsl " href= "DeviceGroup.xsl "?>
<languages>
<language> zh_CN.xml </language>
</languages>
zh_CN.xml
<?xml version= "1.0 " encoding= "UTF-8 "?>
<root>
<table> 你好 </table>
</root>
en_US.xml
<?xml version= "1.0 " encoding= "UTF-8 "?>
<root>
<table> hello </table>
</root>
bbb.xsl
<?xml version= "1.0 " encoding= "UTF-8 "?>
<xsl:stylesheet version= "1.0 " xmlns:xsl= "http://www.w3.org/1999/XSL/Transform ">
<xsl:output method= "xml " version= "1.0 " encoding= "UTF-8 " indent= "yes "/>
<xsl:template match= "/ ">
<groups>
<xsl:apply-templates select= "/root/table "/>
</groups>
</xsl:template>
<xsl:template match= "root/table ">
<table border= "2 ">
<tr>
<td> <xsl:copy-of select= "document(.)//table "/> </td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>
还有一个Servlet当中的doGet方法
public void doGet(HttpServletRequest request, HttpServletResponse response)throws
ServletException,
IOException,
java.net.MalformedURLException {
try {
response.setContentType( "text/html; charset=UTF-8 ");
PrintWriter out = response.getWriter();
Locale clocale = request.getLocale();
StringWriter resultStringWriter = new StringWriter();
XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
processor.setStylesheetParam( "lpfile ", "clocale ");
String xml_doc = "E:/test/aaa.xml ";
String stylesheet = "E:/test/bbb.xsl "; processor.process(new XSLTInputSource(xml_doc),new XSLTInputSource(stylesheet), new XSLTResultTarget( resultStringWriter));
out.write(resultStringWriter.toString());
out.close();
} catch (
SAXException &n