Comments
Patrick Collands wrote: collands (AT) gmail com I'd be very grateful for an invitation. Thank you.
Cloud Expo on Google News

SYS-CON.TV

2009 East
PLATINUM SPONSORS:
IBM
Smarter Business Solutions Through Dynamic Infrastructure
IBM
Smarter Insights: How the CIO Becomes a Hero Again
Microsoft
Windows Azure
GOLD SPONSORS:
Appsense
Why VDI?
CA
Maximizing the Business Value of Virtualization in Enterprise and Cloud Computing Environments
ExactTarget
Messaging in the Cloud - Email, SMS and Voice
Freedom OSS
Stairway to the Cloud
Sun
Sun's Incubation Platform: Helping Startups Serve the Enterprise
POWER PANELS:
Click For 2008 West
Event Webcasts
Building a Flexible Presentation Framework
Building a Flexible Presentation Framework

Information interchange has become key to survival in an increasingly wired world. It is in this context that industries have adopted XML as the enabling mechanism to achieve application integration. XML is ideally suited for designing a Web application that has multiple pages, some of which display common business information.

If XML can be used to represent the application's business information, then XSL can be used to transform the XML for each of these pages. While Web designers can design the pages for the Web application, they can't be expected to design XSLT stylesheets. Stylesheet designers, on the other hand, are good at embedding transformation logic but are not conversant with writing HTML code or presentation tricks. This makes it hard to write XSLT stylesheets that transform the XML to HTML specific to each page. If Web designers can add special "tags" as placeholders for content, then those tags can be transformed at runtime using stylesheet rules.

This article will address performance, flexibility, and ease of maintenance in the context of a framework that combines the capabilities of Java servlets, XML, and XSLT to present business information as Web pages to an end user.

The Basics
XML is a subset of SGML. It was developed to provide features that are related to Web publishing environments.

XHTML is well-formed HTML. The loosely defined HTML specification can introduce interpretation problems to the browser and make it harder for HTML writers to validate the correctness of the HTML pages. Most browsers today attempt to interpret and render incorrect syntax in HTML pages, but sometimes the interpretation can be completely incorrect. This causes the rendered pages to be meaningless to the user. XHTML helps solve this problem since it requires HTML to be well formed. This means XHTML writers could validate their documents before publishing them. XHTML browsers can render XHTML documents correctly, eliminating the guesswork. Therefore, users can rely on the correctness of the document that is rendered by the browser.

XSLT is a high-level declarative language, intended for transforming XML documents into other XML documents. XSLT expressions are used to describe rules for transforming XML documents.

The Problem
Developing a Web application is a very challenging task that requires individuals of different skill levels. For example, a Web designer has organizational and artistic skills and uses design tools to design the layout for Web pages. But a Web designer doesn't necessarily have any technical skill, and may have little or no knowledge of HTML, which is the final product of the design. The Web designer may also lack the programming skills to develop an application that retrieves relevant data from data sources for use in Web pages. On the other hand, a Web application developer has programming skills. He or she knows how to write Web applications to retrieve relevant data from data sources.

Both the Web designer and the Web application developer have to coordinate through the entire development of a Web application, modifying the same set of Web pages, typically as HTML or JSP pages. Changes to the Web pages by one person usually affect the other. For example, if a Web page designer changes the layout of a Web page, he or she might accidentally delete the work done by a Web developer. Or, changes to a Web page by a Web developer might also accidentally cause changes to the layout. If these people don't work for the same company, sharing the same set of Web pages during development can pose a very difficult problem. Also, maintaining HTML Web pages is challenging, since HTML pages aren't easy to validate because well-formed HTML syntax is not guaranteed. Changes to HTML pages could potentially render them unusable or cause them to display differently on different browsers.

The Architecture
To solve these problems, we need to minimize the dependency between Web designers and Web application developers. We could allow the Web page designer to work on Web (XHTML) pages, and let the Web application developer work only on the application, with little or no dependency on the actual Web pages. This would tremendously increase the efficiency and productivity of both. Changes by either would have no impact on the other throughout the development of the Web application.

Requiring that the page be produced in XHTML instead of HTML can solve the maintenance problem of HTML pages. If Web pages are produced in XHTML, it can validate syntax correctness easily using various tools. This will guarantee that changes to Web pages do not render them unusable or cause them to be rendered differently by different browsers.

By introducing special tags to XHTML pages, the Web page designer can concentrate on design, without worrying about sharing Web pages with the Web application developer. These special tags are invented as a contract between Web page designer and Web application developer. At the beginning of and throughout the development of a Web application project, both the Web page designer and the Web application developer agree upon a set of special tags that the Web page designer needs for designing Web pages and the Web application developer needs to supply to the Web page designer. The Web page designer inserts these special tags into XHTML pages, where data supplied by the application program will be populated at runtime. The Web application developer references these special tags in the application code. A common XSLT stylesheet is developed to transform these special tags in the final process.

After Web page designs have been finalized, the Web designer and the Web application developer together define what data needs to be used and in which Web pages. Then, they define a set of data needed for each Web page. Along with the data for each Web page, names of all data are uniquely defined. The Web page designer uses special tag "fields" as placeholders for each type of data needed in a Web page. An attribute "name" of each "field" is used to uniquely define each data element in each Web page. (See bold lines in Listing 1, XHTML Web Page.)

The Web application developer develops a corresponding XML template for each XHTML Web page. (See bold lines in the example of a corresponding XML template, below.)

<template>
<field name="user.username"/>
<field name="user.password"/>
</template>

The Web application developer writes application code to retrieve data and references these field elements in the corresponding XML template. At runtime, requests from the browser to the Web application result in invocation of the corresponding piece of application code, which in turn retrieves the needed data and inserts it into the corresponding XML template. A simple XSLT rule is used to insert this XML template into the corresponding XHTML document. A final transformation using a common XSLT is used to transform this XHTML into an XHTML document that is understood by the browser. This final XHTML document is then returned to the browser.

Discussion
Maintenance and isolation of the development of Web applications can be done quite easily. But XSLT is an interpreted process - every request results in interpreting an XML document, which can be a slow process. Having to interpret and transform XML documents for every request can incur high overhead to the Web application. Optimization is needed to minimize these overhead costs. Caching the XML template, XHTML document, and common XSLT stylesheet will reduce the overhead by eliminating the need for reconstruction for every request.

For easy and rapid Web application development, a tool can also be developed for the XML template and can generate the application code using information from the generated XML template to insert the data element into the XML template. This will reduce the requirement that the application developer has to know XML and XSLT and reduce development time because the application developer writes less code and, of course, there are fewer bugs to find and fix.

Conclusion
Of the many approaches that exist to develop a Web application, an approach to using standard XHTML and XML templates with a set of common XLST can reduce Web application development time and provide ease of maintenance for the Web application.

Resources

  • Ladd, Eric; O'Donnell, Jim; Morgan, Mike; and Watt, Andrew H. (2000). Using XHTML, XML and Java 2 Platinum Edition. Que.
  • Goldfarb, Charles F., and Prescod, Paul. (2001) Charles F. Goldfarb's XML Handbook, 4th Edition. Prentice Hall.
  • XSL Transformations (XSLT) Version 1.0. W3C Recommendation. November 16, 1999.
  • Extensible Markup Language (XML) 1.0 (Second Edition). W3C Recommendation. November 6, 2000.
  • XHTML 1.0 The Extensible HyperText Markup Language (Second Edition), A Reformulation of HTML 4 in XML 1.0. W3C Recommendation. January 26, 2000, revised August 1, 2002.
    About Sawat Hansirisawat
    Sawat Hansirisawat is a senior software architect at Cysive, Inc., based in Reston, VA. Sawat has worked in the software industry for over 20 years and currently works in the product development group on the Cysive Cymbio Interaction Server. Sawat earned an MS degree in computer science from American University and holds a BS degree from Chulalongkorn University in Thailand.

  • In order to post a comment you need to be registered and logged in.

    Register | Sign-in

    Reader Feedback: Page 1 of 1

    Latest Cloud Developer Stories
    The Enterprise Cloud Requires a real time infrastructure and a management discipline that understands and can enforce service level discipline.
    CloudBench Applications, Inc. announced its financial results for the three months and nine months ending September 30, 2009. All amounts are stated in Canadian dollars unless otherwise noted. Revenues from BasicGov, the Company's cloud computing solution for local government, gr...
    The new contract is an industry first, with CSC being the first Microsoft partner to lead and win a cloud computing services agreement of this scale. Under terms of the contract, CSC will provide Royal Mail Group's 30,000 employees with access to new IT services using Microsoft's...
    Operates in over 170 countries and is one of the world’s leading providers of communications solutions and services. Richard Tarboton talks for MeettheBoss.TV on his role as Head of Energy & Carbon for BT and what they are doing towards reducing carbon emissions.
    CA is going to put its Agile Planner software on salesforce.com’s Force.com platform in the first half to accelerate development time and give users visibility over their development initiatives to reduce time-to-market. Customers are supposed to be able to accelerate the deploym...
    Subscribe to the World's Most Powerful Newsletters
    Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
    Click to Add our RSS Feeds to the Service of Your Choice:
    Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
    myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
    Publish Your Article! Please send it to editorial(at)sys-con.com!

    Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

    SYS-CON Featured Whitepapers
    ADS BY GOOGLE

    Breaking Cloud Computing News
    CloudBench Applications, Inc. announced its financial results for the three months and nine months e...