servlets - How to apply a stylesheet to castor Marshaller output stream -


what best way apply xslt castor marshaller output stream?

i send xhtml client in servlet. i've tried buffer data in string, , putting pipeline xalan, seems expensive , there ought way process stream once.

public void doget(httpservletrequest request, httpservletresponse response)         throws servletexception, ioexception {      string strgpxid = request.getparameter("id");     long gpxid = long.parselong(strgpxid);      // set content type html.     response.setcontenttype("text/xml; charset=utf-8");         // output goes response printwriter.     java.io.printwriter out = response.getwriter();     try     {   // private method call fetch gpxdb         gpx gpx = this.getgpx(gpxid);         stringwriter strwriter = new stringwriter();          marshaller marshaller = new marshaller(strwriter);         marshaller.setencoding("iso-8859-1");         marshaller         .setschemalocation("http://www.topografix.com/gpx/1/1/gpx.xsd"); 

// marshaller.addprocessinginstruction("xml-stylesheet", "href='gpsxmlquickview.xsl'");

        printwriter pw = response.getwriter();         marshaller.marshal(gpx, pw);      }     catch (exception e)     {       out.write(e.getmessage());       e.printstacktrace(out);         }     out.close();   }   

tia


Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -