Formatting XML for the Web
IN THIS CHAPTER
• A Brief History of DSSSL
• A Brief History of CSS
• XML Presentation Using CSS
• An Overview of XHTML
• An Overview of XForms
XML is a data structuring language. XML provides meaning for your data. However, something that XML does not do is provide formatting for your data. There is no indication in an XML document or in the XML specification for how XML data should be dis-played for human consumption. This is an important consideration. Although XML is designed to be multiplatform compatible and easily consumable by machines across the entire spectrum of operating systems, there is no indication of how XML should be con-sumed by humans.
XML does, however, allow tags to be defined in a self-describing manner (this is indeed recommended). When viewing the XML tag Dog, you can be fairly certain what the tag is referring to. However, if the XML file gets large or the structure gets overly complicated (such as a mathematical formula or a chemical element definition), the XML file might not be easily legible to the human eye. Therefore, an easy way to format XML data is needed so that humans can easily consume it.
In HTML, the structure and formatting for data are combined. Although HTML is very effective at formatting data for appearing on the Web, HTML is, for all intents and pur-poses, limited to the Web. XML has separated itself from formatting. This serves to make XML far more flexible in terms of how it may be used and displayed. XML may have formatting applied so that it appears in a desktop PC application, a handheld PC applica-tion, a mainframe terminal, a Web browser, and so on.
This chapter focuses on several of the technologies used for formatting, delivering, and gathering XML data on the Web. First, we’ll cover some of the history of data format-ting, starting with a brief look at the Document Style Semantics and Specification Language (DSSSL) and Cascading Style Sheets (CSS). You will see how CSS can be used to provide some formatting for XML data. Then we will look at XHTML—a refor-mulation of HTML into an XML application. Finally, we will briefly look into the future by covering XForms, another XML application, which is the intended replacement for HTML forms.
Before covering some of the newer technologies used for displaying XML on the Web, we will take a look at some older data-formatting technologies: DSSSL and CSS. This should give you a good overview of where we have come from so that you might better understand where we are going.