[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XT as servlet
Boy, do I wish this thread had come up before I spent several hours
trying to do this. I was able to get the XT servlet running
using Sun's reference implementation JSP server,
jswdk-1.0.1,
There is a brief blurb in the XT documentation that tells how to use the included XT servlet,
So, in simple terms, you query a reference to an XML file (on the server) and the Servlet processes it according to the one, predefined stylesheet, delivering the result to your browser. To test this, you could configure a servlet that processes the example file "sort-uniq.xsl" and then browse to the XML file "sort-uniq.xml" - what appears in your browser will be a sorted list of uniquely-occurring bullet items. BTW, don't try the "slides" example, since the servlet doesn't know what to do with separate files. (I suppose for it, you could write a servlet that processed the XML into a directory and then redirected your browser to the first slide HTML file in the sequence of slides.) If you want to render sort-uniq.xml according to another stylesheet, you'll have to set up another servlet. I suppose that the source code could be rewritten to pull off a reference to the XSL file, e.g., from a query parameter, and then dynamically instantiate a processor for that spreadsheet. If performance or startup overhead is a factor, then I suppose one could even set up a caching facility to cache multiple stylesheet processors and clone as needed. Documentation for JSWDK is also light. It tells you to set up an application directory, possibly by cloning the examples directory, and put that into the JSWDK directory. I called mine XTServlet, but I probably should have called it <stylesheet-name>, e.g., TableRenderer.
Next, you compile the XSLServle.java code (don't forget to tell java where the requisite .jar files are) and, using the -d flag and a file path, place the result into in the directory
I also put my .xml files, .css files, and .dtd files in that directory, for simplicity. Finally, there's the URL. To invoke the servlet on "table1.xml", I used the following URL:
Note that either IE5 or Netscape 4.x can display the generated HTML (duh), but the XML+XSLT that XT takes is not necessarily going to be rendered properly in IE5 and vice versa. For example, IE5 wants ".[" whereas XT wants "self[". If anybody knows how to improve on this, please post a followup. Mark Feblowitz
Senior Principal MTS
GTE Laboratories Incorporated
Waltham, MA 02451
http://tec.gte.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|