Sorry. I know this is not the right forum. I tried in users forum and nobody gave me a good answer. Thought some of you geniusus here would have an answer. Thank you.
Hi, I am able to get an xml output from a custom generator.The custom generator creates an xml from an http request. The http request can replaced by a xml string as an example. It displays in the browser as XML tree. But,I am not able to transform the output with an xsl stylesheet. It displays the data as text. What am I doing wrong. Please help. Thank you. Here is my sitemap: <map:match pattern="mygenerator.xml"> <map:generate type="mygenerator"> <map:parameter name="use-request-parameters" value="true"/> </map:generate> <map:transform src="stylesheets/test.xsl"/> <map:serialize type="html"/> </map:match> ------------------------------ Here is my custom generator code. (Sorry for the long code) public class MyGenerator extends AbstractGenerator { Request request = null; Enumeration paramNames = null; public void setup(SourceResolver resolver, Map OjectModel,String src, Parameters par) throws ProcessingException, SAXException, IOException { public void generate () throws IOException, SAXException, ProcessingException { try{ SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setValidating(false); SAXParser saxParser = spf.newSAXParser(); // create an XML reader XMLReader reader = saxParser.getXMLReader(); String message = getResponse(); /*this message can be a xml string*/ reader.setContentHandler(super.xmlConsumer); reader.parse(new InputSource(new StringReader(message))); } catch(Exception e){} /*XMLReader xmlreader = SAXReaderFactory.createXMLReader(); xmlreader.setContentHandler(super.xmlConsumer); InputSource source = new InputSource(new StringReader(message)); xmlreader.parse(source);*/ } private String getResponse() { String xmlResponse = new String(); String inputLine; String urlstr = "http://srv/cgi-bin/cgiip.exe/getxml.p";; String str = "?"; try{ URL url = new URL(urlstr); URLConnection connection = url.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); while ((inputLine = in.readLine()) != null) { if (xmlResponse==null) xmlResponse = new String(); xmlResponse = xmlResponse + inputLine; } // while in.close(); } catch(Exception e){ System.out.println("ERROR WHILE CONNECTION: " + e.toString()); return "<response><status>ERROR</status></response>"; } return xmlResponse; } Thanks in advance. Rajesh Aravindakshan Regards, Rajesh Aravindakshan Regards, Rajesh Aravindakshan __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/