|Chapter 14 - Keys and Cross-Referencing|
|XSLT For Dummies|
|by Richard Wagner|
|Hungry Minds 2002|
In This Chapter
I remember the first time I ever heard the term cross-reference. I was in school, scouring through the librarys card catalogue , trying to find some obscure book on Ancient Greece. With todays technology, cross-referencing has been transformed from the kind of labor- intensive process that I faced in that dusty ol library into a simple, point-and-click motion on a computer. (Did I also tell you that I had to walk two miles to school each day in a foot of snow in bare feet? Well, I tell my kids that anyway.)
The Web is built on top of this notion of cross-referencing. The reason is obvious: Storing all the information available on the Web in a single gigantic page makes no sense, of course, because such a page would be unusable. Instead, related Web pages are linked together using hypertext.
Relational databases, such as Microsoft Access, are another example of how you can effectively cross-reference related information. For people who need to work with even small amounts of data, storing data across multiple tables is easier to maintain than dumping everything into a single massive table.
In case youre unfamiliar with databases, the basic notion of a relational database is to store the information in the place that makes the most sense. For example, you may store customers information, orders, and parts into separate databases. And, then, when you want to use this information, you can link the related pieces together for the task you wish to perform.
It follows , then, that for XSLT to be flexible and useable for a variety of purposes, it also needs to offer a similar cross-referencing device. Otherwise, you could never bring together elements from disparate XML structures and integrate them in a result document. Instead, youd be forced to create huge monolithic XML elements that would contain every possible piece of data in it, including the kitchen sink. In this chapter, you find out about how XSLT uses keys that enable you to cross-reference your source documents.