Re: JSP or XSL?
3/7/2002 4:53:17 AM, "Christer Nordvik" <christer.nordvik@t...> wrote: >I have an XML document that I want to output as SVG. Is it better to use >XSL/XSLT than to use JSP/JavaBeans to generate the final document. The >XML document contains tags that I don't want in the final document like >"<rowset>" so I have to just include parts of it. Oh goodie, another religious war! <grin> Has the declarative vs procedural controversy been aired here recently? I doubt if one is unambiguously "better" than the other approach. It really comes down to what tools you have available (and your level of comfort with the tools) that are appropriate to a given problem. I'd hazard a guess that since SVG has a DOM API, and since you can more easily call a 3rd party DOM implementation from JSP/JavaBeans than from XSLT, that might be the better way for you. XSLT would almost certainly make you deal with the SVG at the syntax level rather than the SVG DOM level, but if you're comfortable with XSLT and SVG syntax, go for it! Also, it depends if you need to transform the input data much before stuffing it in the SVG output. If you need to look things up in external databases, do some math on the data, or some other non-trivial manipulation, JSP/Beans might be more convenient and portable than the equivalent XSLT solution. JSP seems to me like roughly the same design pattern as XSLT: you start with a template and fill in the empty spaces by with some code (procedural in JSP, declarative in XSLT). XSLT natively understands XML and XPath patterns, so is very handy for pulling XML out of an input document and stuffing it into the empty spaces. On the other hand, most decent DOM implementations "embrace and extend" the standard to support XPath, so you can do that same thing in JSP too. I would be very interested in seeing a few non-trivial problems of this sort being addressed both ways, with the solutions shared/critiqued, so that we can all get a better handle on the guidelines for when a JSP (or ASP, or PHP, or "DOM code filling in an XML template") approach is more effective, and when a pure XSLT approach is more effective. Has anyone done something like this before?
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