Jeff, Thanks, this is very helpful in that it gives me more of an idea how the whle thing fits together. As I stated in a response to another post - I'm still a littly foggy on why I need to create a tool or indeed any java code at all to call a service, but I'll believe you :)..
One question - in your example you are calling: xsltTool.getProductDescriptionHTML($productID) Right now my xsl templates create fully formed HTML that would not work as an HTML code fragment. This begs the question of exactly where exactly would I be calling this tool from? I think that part of the problem is that the example apps use the push model and I don't understand how this maps to the layout/navigation/screen model. In other words if I called it from Myxslscreen.vm (being referenced by a layout) I wouldn't get a well formed HTML page (assuming that I use my existing xsl templates). Perhaps a reasonable approach would be to create Myxslscreen.vm that only contained: xsltTool.getProductDescriptionHTML(123456) and create a layout called Myxslscreen.vm that only contained: $screen_placeholder I don't know, I'm just guessing at this point, any additional help would be greatly appreciated. Thanks, Dan Jeff Linwood wrote: >Hi, > >To use a service from a Velocity template, create a tool to access the >service indirectly. Depending on how your application is set up, you'd >probably want to do all of the XSLT transformation inside the tool, and not >expose it to velocity. > >To set up the XSLT Service, change this property in your >TurbineResources.properties (in WEB-INF/conf of your generated app) >services.XSLTService.path = /path/to/stylesheets > >to > >services.XSLTService.path = /xslt > >or whatever. > >Use the pull model HOWTO to help you add a tool to Turbine. I'd configure >the tool as global scope, but this really depends on your application. > >The tool can access your database to pick up XML for a product or what have >you. For instance, if you stored a piece of XML as a description of a >product, you could write a method in your tool with a signature like >getProductDescriptionHTML(String productID). This method would call another >method which got the XML out of your database and returned it as a String. >Use a StringReader to get your XML ready for the XSLTService. > >Inside the tool, use the static XSLTService helper utility class >org.apache.turbine.services.xslt.TurbineXSLT to call the transform methods >on the service. Call the transform method on the service, which returns a >String. Use the filename of your XSLT style sheet for the xslName parameter. > >>From inside your Velocity template, call >$xsltTool.getProductDescriptionHTML($productID), which will return HTML. > >Jeff >----- Original Message ----- >From: "daniel robinson" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Wednesday, July 03, 2002 7:00 PM >Subject: Action/Service/Upload/XSLT Noobie Woes > > >>I've been at this all day, and I give up :). >> >>What I'm trying to do: >>-Generate HTML using a stylesheet and XML from a database. >> >>Strategy: >>-Use the XSLTService to perform this. >>-Use doco and examples to figure out how. >> >>Issues: >>- I don't understand how to use the XSLTService within Turbine. I've >>read the doc (not much there), looked at the examples (none for >>XSLTService), searched the listserv archives (still nothing), and posted >>a message (still not working). >>- I decided to take it one step at a time and figure out how to use a >>documented and exampled service - I chose upload. >>- From what I can tell the Upload example does not use the UploadService >>:(. But defines a application level action to do this. >> >>Assumptions: >>- A service can be called directly from within a template using Velocity >>and I don't need to write an action. >> >>What I would like: >>- A clean example of an application that uses XSLTService, or >>- A clean example of an application that uses some service that I can >>use to figure out how to use XSLTService, or >>- Someone to spell out exactly what I need to do. >> >>Help appreciated, >> >>Dan >> >> >> >> >>-- >>To unsubscribe, e-mail: >> ><mailto:[EMAIL PROTECTED]> > >>For additional commands, e-mail: >> ><mailto:[EMAIL PROTECTED]> > >> > > >-- >To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> >For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
