Seven Steps to XML Mastery, Step 2: Display for the Web
With step 1 to XML mastery—learning how to read XML code—behind us, it’s time to go to work. In this article, we move on up to step 2 and tackle the often tricky problem of how to get XML content out onto the Web. ZwiftBooks, a web-based bookseller that prides itself in getting books to customers who "need it now," has hired you to help increase ZwiftBooks’ web presence—and, by implication, improve the bottom line. You’ve convinced the ZwiftBooks management that XML-izing their data will lead to only good things for the company.
Welcome to Duty
It’s the first day of work. Each week, manager Bob calls together the web design team (Wilma and company) and hands them a report listing the five most popular ZwiftBooks and the five most popular authors. Wilma takes the list, cranks up Dreamweaver, her favorite web development environment, and inserts the titles, authors, links, and prices—all the information that management would like see reflected in the web site.
Then Bob turns to you and asks, "If we get our book and pricing data into XML, will we have more timely updates without asking our web design team to put in more hours?" Your answer, of course, will be "Yes," but to keep that answer from being a vacant promise, you’ll need to combine a bit of XHTML with some XSLT. (We’ll meet XSLT in step 3.)
Before we look at XSLT, we need to perform some due diligence and make sure that the web team at ZwiftBooks is set up to allow XSLT to work its magic. Our goal is that, each time a user visits the site, he or she will encounter the most recent ZwiftBooks data.