XSL Transform of an XML Document for both PC and WAP Browsers

Maintaining an updated website can require more time than you might expect. For those interested in maintaining a Mobile website in addition to their regular website, the time required can more than double. One powerful mechanism to provide content to both websites, involves the use of XSL Transform language to serve both HTML and WML code from a single source- usually an XML document file.

When both your PC and mobile websites are closely integrated, a common files that can be transformed for either a PC or a Mobile browser may make sense. To satisfy this need, we embarked upon the project of displaying an XML file used to store simple news stories by transforming the data using an XSL Stylesheet. The transformation takes place via a Java servlet using an XSL Transformer. When a request is made by a browser, the servlet determines the type of browser by its user-agent parameter and selects the appropriate stylesheet. For example, if a Mobile browser makes the request, the XML file containing the news data is transformed using a stylesheet that will provide WML code. If the browser is the normal PC type browser, the Java servlet will choose the html stylesheet, and thus transform the XML file into HTML code.

For those interested in the technical side, here is a list of text files which include the necessary data and transformation files. The Java code used in the servlet is not included.

News Data File
HTML XSL Stylesheet
WML XSL Stylesheet
The Socker Fan is a website for S. East PA Girls Soccer and used a single guestbook for its PC and Mobile websites. For those interested in seeing the results, you can access The Sockerfan's Guestbook from their PC website at www.sockerfan.com and their mobile site from www.sockerfan.com/tsf.wml

Click here to return to The Fieldmaster home page...
www.fieldmaster.org