The Artima Developer Community
Sponsored Link

Java Buzz Forum
XSLT the Good the Bad and the Ugly

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Wolf Paulus

Posts: 692
Nickname: wolfpaulus
Registered: Jan, 2004

Wolf Paulus is an experienced software developer focusing on Java, XML, Mac OS X, wireless/mobile ..
XSLT the Good the Bad and the Ugly Posted: May 30, 2004 2:42 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Wolf Paulus.
Original Post: XSLT the Good the Bad and the Ugly
Feed Title: Wolf's Web Journal
Feed URL: http://wolfpaulus.com/feed/
Feed Description: Journal - dedicated to excellence, and motivated by enthusiasm to trying new things
Latest Java Buzz Posts
Latest Java Buzz Posts by Wolf Paulus
Latest Posts From Wolf's Web Journal

Advertisement
XSLT (eXtensible Stylesheet Language) is a powerful tool, which I have used several times over the last 4 years. Still, even after all those years, XSLT doesn't come easy to me and I'm only considering it when the output format is XML, XHTML, or TEXT and the target document can be generated in single transformation.
More complex XSLT scripts may be hard to write but I found them even harder to document, localize, and maintain.

JSP, JDOM and JAXEN
As an alternative to XSLT, I have used JSP. JSP is a scripting language and comes with many of the advantages that XSLT gives you, i.e. JSP can make use of XPath by using JDOM and JAXEN. JSP also comes with many of the advantages that JAVA gives you, i.e. extensive Java class libraries, powerful tools and most of all, JSP are debug-able. However, more complex JSPs seem to have almost the same aforementioned problems when it comes to maintainability and documentation.

Tag-Libraries to the Rescue
Lets imagine a server providing XML documents, which contain the data that needs to be displayed in a highly dynamic and customizable WebUI. Even with STUTS and JSF around, my preferred approach for creating that user interface would still go something like this:

1.) I would employ a small Java Class Library, I have written some time ago. Its classes match the well-known HTML tags. For instance, there is an HTMLTable class, capable of writing HTML tags for an HTML-table into a print stream.

2.) Next, I would write a simple object model (thin layer over the XML), which relies heavily on XPath and helps accessing data elements in the XML documents. You may think that this would be great a job for JAXB, but not always do you have an XML-Schema for the XML documents the server generates.

3.) Finally, custom JSP-Tags are developed, using both abovementioned class libraries, feeding the data from the XML document into the HTML tags, which print in the output stream.

4.) The custom JSP-Tags are eventually used in JSPs that are very short and easily customizable, even by non-programmers. As always, cascading style sheets (CSS) are being developed and used to fit the JSPs into the corporate design.

Still, a final warning needs to be given. For JSP-Tag Libraries once again, there don't seem to be documentation tools or standards and you end up writing your own JSP-Tag-Lib Documentation Tool, using XSLT and Java-Introspections.

Read: XSLT the Good the Bad and the Ugly

Topic: Assumptions Previous Topic   Next Topic Topic: The Storm in a Teacup Continued

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use