Designing the Layout

As soon as you have the data side of things sorted out, you must think about the layout you want to present. Using the sample data from the preceding section, you can design stylesheets that will format the news into three of the most popular formats: HTML, WML, and XSL:FO for serialization into PDF.

HTML

A news portal must be able to provide the news in an HTML format, so you need to design a stylesheet for this purpose. Listing 5.2 shows a sample stylesheet you can use in your application.

Listing 5.2. The Stylesheet for Formatting RSS into HTML
<?xml version="1.0"?> 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
<xsl:template match="*|/"><xsl:apply-templates/></xsl:template> <xsl:template ...

Get Cocoon: Building XML Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.