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 FileThe 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
HTML XSL Stylesheet
WML XSL Stylesheet
Click here to return to The Fieldmaster home page...