POLITECHNIKA RZESZOWSKA - Wydoat Elektrotechniki l Informatyki
import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import javax.xml.transform. *; import javax.xml.transform.stream.*; public class SimpleXSLTServlet extends HttpServlet { public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html; charset=0TF-8"); PrintWriter out = response.getWriter(); try {
TransformerFactory factory =
TransformerFactory.newlnstance(); Transformer transformer = factory.newTransformer(new
StreamSource(sample.xsl)); transformer.setOutputProperty("encoding", "UTF-8"); transformer.transform(new StreamSource(sample.xmli, new StreamResult(out));
catch(Exception e) ( e.printStackTrace(); }
WM
-ł 1AVA WtklAd 14-LoiyrĄH f Ki 2 Jbn H/UtU*