[Opensource] xsl handling: make it like JSP handling?

Michael Rimov rimovm at centercomp.com
Thu May 8 22:21:04 PDT 2003


At 02:04 PM 5/8/2003 -0700, you wrote:

>Hi,
>
>XSL configuration in Expresso left me wanting something better. In 
>particular, the setup page for XSL mappings is difficult to use, and 
>doesn't seem as useful as the way JSPs are handled.
>
>In order to make XSL configuration just like JSP configuration, I added 
>the following code to Controller.java around line 1856 at the end of 
>Controller.perform()
>
>             // xsl processing
>             if (fwd != null) {
>                 String path = fwd.getPath();
>                 if (path != null && path.endsWith(".xsl")) {
>                     fwd = mapping.findForward("xml");
>                     req.setParameter("xsl", ConfigManager.getConfigDir() 
> + "/../.." + path);
>                 }
>             }
>
>So that a configuration entry like
>
>         <action path="/GroupAction"
>                type="com.blah.GroupAction"
>                name="default"
>               scope="request"
>            validate="false">
>
>             <forward name="displayItem" 
> path="/jsp/groupAction/displayItem.jsp"/>
>             <forward name="rootTree" path="/xsl/rootTree.xsl"/>
>     </action>
>
>
>(which has both a state with a JSP rendering and a state with an XSL 
>rendering) will have both renderings handled appropriately.
>
>This is not checked into Expresso, but I would like to hear comments about 
>adding this, especially if there is a better way.

Hi Larry,

Good idea!  How about instead of modifying controller, you modify the xsl 
servlet to take an xsl URL like so:

<forward name="displayItem" path="/jsp/groupAction/displayItem.jsp"/>
<forward name="rootTree" path="/servlet/XMLViewHandler/xsl/rootTree.xsl"/>

Have mappings to XMLViewHandler be:
         /servlet/XMLViewHandler*
[Similar, to say, turbine servlet]

And then have XMLServlet parse the request to figure out what stylesheet to 
use?

Although it's not quite at simple, code-wise it would successfully leave 
Controller alone, thus only modifying the XML Servlet, and it would give 
you the same ability that you desire.

Again, I like the basis of your idea.
                                                 -Mike





More information about the Opensource mailing list