webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Servlet and XSL

    Posted Thu July 12, 2001 10:10 AM

    Hello
    I’m loking for a simple example of the presentation XML data(from Tamino) in Java servlet. XML data should be formatted with XSL. XSL sheet must be placed in String (or String )variable or in Tamino data.

    I’ll be gratful for examples and suggestions.

    Best regards
    Leszek


    #API-Management
    #Tamino
    #webMethods


  • 2.  RE: Servlet and XSL

    Posted Fri July 13, 2001 10:09 AM

    Here comes an example of using Tamino with Servlets and xerces:

    xmlparser myParser = new xmlparser();
    PrintWriter out = new PrintWriter(resp.getOutputStream());
    String query = “…taminoQuery…”;
    String xslDatei = “… name of xsl-File…”
    String ErrorMsg=myParser.ParseXMLDocument(query, xslDatei, out);

    class xmlparser contains method ParseXMLDocument:

    import org.xml.sax.SAXException;
    import org.apache.xalan.xslt.XSLTProcessorFactory;
    import org.apache.xalan.xslt.XSLTInputSource;
    import org.apache.xalan.xslt.XSLTResultTarget;
    import org.apache.xalan.xslt.XSLTProcessor;

    public String ParseXMLDocument ( String XML, String XSL,PrintWriter myPrintWriter ) {
    try {
    processor.process(new XSLTInputSource(XML), new XSLTInputSource(XSL),
    new XSLTResultTarget(myPrintWriter));
    return “”;
    }
    catch (Exception e) { processor.reset(); return e.toString(); }

    Hope it helps!
    Uli Licker


    #Tamino
    #API-Management
    #webMethods


  • 3.  RE: Servlet and XSL

    Posted Sat April 20, 2002 06:35 AM

    Hello Uli,
    I read the code that you posted but I couldnt find the xmlParser class in the Xerces API, and there was no method called parseXMLDocument(). Will otherparsers like DOM builder work?
    Also once the transformation is complete, how does the printwriter() work? I couldnt understand…Please help me. Thanks a lot,
    Best Regards,
    Parth B


    #API-Management
    #Tamino
    #webMethods


  • 4.  RE: Servlet and XSL

    Posted Mon April 22, 2002 01:35 PM

    parthb: I don’t think you’ve understood the code that Uli posted, the class xmlParser was a user-written class not one supplied with Xalan or Xerces. However, there are a lot of gaps in Uli’s code (things he hasn’t shown), and I suggest you don’t start from here. There are examples of how to invoke Xalan from a servlet in the Xalan documentation; the only thing that’s special about doing it in Tamino is that the source document (and perhaps the stylesheet) are read by means of URIs that incorporate Tamino queries.


    #API-Management
    #webMethods
    #Tamino