Ajax with xsl
Using Ajax, how can I present the xml data using xslt, returned by the server to the client.
My servlet code:
void doGet(HttpServletRequest req, HttpServletResponse res){
res.setContentType("text/xml");
res.setHeader("Cache-Control", "no-cache");
PrintWriter writer = response.getWriter();
StringBuffer sb=new StringBuffer();
sb.append("<?xml version='1.0' encoding='ISO-8859-1'?>");
sb.append("<?xml-stylesheet type='text/xsl' href='EmployeeDetailList.xsl'?>");
sb.append("<Employee>");
sb.append("<Id>E100<Id>");
sb.append("<Name>SURESHKUMAR</Name>");
sb.append("<Job_Name>DEVELOPER</Job_Name>");
sb.append("</Employee>");
writer.println(sb); //send the xml response to client.
writer.close();
}
Instead of using this method responseXML.getElementsByTagName() in the javascript, to access the xml data, I want to present the data using xsl to the client.
I am not ambitious, as I require this concept for my project.
Thanks,
Suresh.
__________________
Cheers [-:]
Suresh!
|