WMLPrograming list

4.16 How do I use XSL with WML and WAP?

Since WML is actually XML, and XSL transforms a XML document into another, different XML document, the question is appropriate. Please refer to Luca Passani's good article in the march issue of the American magazine WebTechniques.

It's recommended that you have a look at something called Cocoon from the Gods of Apache. "Cocoon is a 100% pure Java publishing framework that relies on new W3C technologies (such as DOM, XML, and XSL) to provide web content. The Cocoon project aims to change the way web information is created, rendered and served. This new paradigm is based on fact that document content, style and logic are often created by different individuals or working groups. Cocoon aims to a complete separation of the three layers, allowing the three layers to be independently designed, created and managed, reducing management overhead, increasing work reuse and reducing time to market. Web content generation is mostly based on HTML, but HTML doesn't separate the information from its presentation, mixing formatting tags, descriptive tags and programmable logic (both on server side and client side). Cocoon changes this view allowing content, logic and style on different XML files and uses XSL transformation capabilities to merge them."
Basically this means that Cocoon will read the HTTP header, work out which browser is used and then apply the correct stylesheet and do the XSL Processing.

Check this reference for a product called LotusXSL which is an XSL processor for transforming XML documents into HTML, text, or other XML document types.

At Sun's Java site, there's a section covering "Java Technology and XML - Portable data, portable code" with several tutorials, APIs and example code.

You might also want to look into XSLT for transforming XML tags into device-specific WML. Check XT for more details.

Also adds that Microsoft has had in fact an XML/XSL rendering engine called XMLISAPI which supplies the same functions as Cocoon, and at TechEd Europe a seminar was dedicated to using it to serve WAP content. From the MS information "The Microsoft XSL ISAPI Filter enables server-side XSL formatting for multiple device-types. It features automatic execution of XSL style sheets on the server, choosing alternate style sheets based on browser type, style-sheet caching for improved server performance, the capability to specify output encodings, and customizable error messages."

Related information

Chapter 9 in "Professional WAP" from Wrox
Chapter 10 in "Professional WAP" from Wrox

[ Main ]   [ 04 - Serving WML contents ]