XML

XML Presentation with XSL and CSS

In the next two tutorials, we will discuss how to use XML with user services components—that is, with the components that run on the client and interact with the user. This tutorial will focus specifically on creating static user services components that can be used to present information to the user. In tutorial 13, we'll move beyond simply presenting information to the user and begin building dynamic user services components that can interact with the user without having to go to a Web server for each response.

As you know, XML data that is brought to a client generally comes in two forms. The first form of data contains elements that define how the content of the document should be displayed. The XHTML document we created in tutorial 5 is an example of the first form of data. The second form of data contains elements that do not define how the document's content should be presented. Since XML was not designed to be a presentation language, the majority of XML documents contain the second form of data—that is, data without specific presentation instructions. XML's strength lies not in its ability to present data, but in its ability to package data into a format that can be validated and easily moved.

If we want to present XML data in a Web browser, it would make sense to transform this XML into another language that is designed for presentation and is in XML format, such as XHTML. Extensible Stylesheet Language (XSL) is designed to transform XML into XHTML and other XML formats so that the XML can be presented in a browser. Currently, XSL primarily transforms XML into XHTML. In the future, though, we could see XSL transforming XML into speech or other formats. This tutorial will cover the presentation of data using cascading style sheets (CSS), XSL, and XSL Transformations (XSLT). Let's begin by looking at XHTML and CSS.