| ============================================================ |
| CONTENTS OF THIS DOCUMENT: |
| |
| o) HOW TO PROVIDE XSL TRANSFORMATIONS AS A WEB SERVICE |
| o) HOW TO INVOKE TRANSLETS FROM A BRAZIL HANDLER |
| |
| ------------------------------------------------------------ |
| HOW TO PROVIDE XSL TRANSFORMATIONS AS A WEB SERVICE |
| |
| This sample code illustrates how Xalan/XSLTC can be used to |
| offer XSL transformations as a web service without using a |
| full web server. We have chosen to use the Brazil prototype |
| for the web interface, available from Sunlabs: |
| http://www.sun.com/research/brazil/ |
| but we could easily have used some other web interface such |
| as Tomcat. The supplied Java code implements a Brazil |
| "handler", which very much resembles a servlet. |
| |
| The CompiledEJB and CompiledServlet sample code |
| demonstrate other approaches to providing XSL transformations |
| as a web service. |
| |
| ------------------------------------------------------------ |
| HOW TO INVOKE TRANSLETS FROM A BRAZIL HANDLER |
| |
| The CompiledBrazil directory contains the example source code: |
| |
| TransformHandler.java |
| |
| This file contains a minimal implementation of an XSL |
| transformation handler. You can find a precompiled version |
| in xsltcbrazil.jar. |
| |
| Compile any stylesheets you're interested in into translets. |
| Set your CLASSPATH to include xalan.jar, xercesImpl.jar, |
| xml-apis.jar, your translet classes and the Brazil server |
| jar file. |
| |
| You can now set up the Brazil server to service requests by |
| using the following command: |
| |
| $ java -Djavax.xml.transform.TransformerFactory=org.apache.xalan.xsltc.trax.TransformerFactoryImpl \ |
| sunlabs.brazil.server.Main -port 8080 \ |
| -handler TransformHandler |
| |
| In a browser, you can enter a URI similar to the following: |
| |
| http://localhost:8080/?translet=myTrans&document=myDoc |
| |
| where "myTrans" is the URI of a stylesheet that you've |
| compiled into a translet and "myDoc" is URI of an XML document |
| you'd like to process using that stylesheet. The result of |
| the transformation will be displayed in your browser. |
| ------------------------------------------------------------ |
| END OF README |