<%@page import="javax.xml.transform.*,javax.xml.transform.stream.*,java.io.*,java.net.*" %> <% Object result = null; if (request.getParameter("submit").equals("View Source")) { response.setContentType("text/xml"); result = request.getParameter("mel"); } if (request.getParameter("submit").equals("Render Result")) { response.setContentType("text/xml"); try { StreamSource xsl = new StreamSource(new URL("http://localhost:8080/execmgr/client/monet2xhtml.xsl").openStream()); Transformer transformer = TransformerFactory.newInstance().newTransformer(xsl); StringReader stringReader = new StringReader(request.getParameter("mel")); StringWriter stringWriter = new StringWriter(); StreamSource streamSource = new StreamSource(stringReader); StreamResult streamResult = new StreamResult(stringWriter); transformer.transform(streamSource, streamResult); result = stringWriter.toString(); } catch(Exception exception) { exception.printStackTrace(); } } %> <%=result%>