XSLT: Working with XML and HTML. (Book Reviews).
XML (Extensible Markup Language) continues to be a major buzzword in technical communication. At this point, even technical writers who do not use XML probably have at least a rudimentary idea of what it is: essentially a markup language that provides the data structure of a document. However, writers who are not yet using it may wonder what exactly you can do with XML. XSLT: Working with XML and HTML provides one answer by furnishing in-depth information about transforming XML documents to HTML using XSLT (XSL Transformations). As Khun Yee Fung explains, "XSLT's original purpose was to transform XML documents to XSL [Extensible Stylesheet Language] documents." XSL is "a language with features that allow you to specify precisely how the output should look." "As defined right now, however, XSLT can do much more. It can also transform to HTML, plain text files, and text files with structures not defined in XML" (p. 6).
This book bills itself as being aimed at the XML novice with no programming background required, and for the most part this does apply; however, many of the concepts discussed in the book are relatively advanced and can be difficult to grasp. Already in this review we are knee deep in acronyms--the material by its nature is full of terminology. The sheer number of terms involved in XSLT and XML may be intimidating to the novice, yet Fung consistently does a good job of explaining and differentiating the terms and acronyms.
Part I features an introduction that includes a broad overview of XML, defining XML itself, explaining the differences between XML and HTML, and explaining ways an XML document can be presented in a browser. The introduction includes an explanation of the role XSLT plays in transforming XML documents to HTML and other formats.
Chapter 2, "XML," explores various facets of XML in detail, including the basic pieces of an XML document such as the document type declaration, elements, attributes, and namespaces. Fung explains the purpose of each piece in straightforward terms and keeps the explanations as free of jargon as possible.
Fung begins Chapter 3, "Introduction to XSLT," by invoking the 80/20 rule: 20% of the features of a "computer tool (including a program language)" are used 80% of the time (p. 22). Fung also notes that the most frequently used features tend to be the most basic. He uses this logic to present the "most frequently used features of XSLT" (p. 22). To explain these features, Fung uses a series of three examples that are part of a rudimentary, browser-based meeting room booking system--a sort of do-it-yourself version of the Microsoft Office Calendar, The examples are basic enough for a relative novice to understand yet contain enough depth to show the power of XSLT to render XML documents into HTML. The chapter, like most others in the book, contains numerous code samples (which are also available on the CD that accompanies the book).
In Part II, Fung probes into technical aspects of XML and XSLT. Chapter 4, "XML documents as trees," is especially adept at explaining the idea of representing concrete XML text documents as abstract "trees, or simple structures composed of nodes and branches" (p. 68). Numerous diagrams assist the reader in understanding how trees represent the structure of XML documents, the terminology used to describe trees, and the different types of trees. In Chapter 5, "Paths," Fung discusses the XML Path Language, Xpath. He explains that Xpath describes how to locate and process XML documents by using syntax based on a document's structure and hierarchy. "When we use XSLT to transform XML documents, we have one or more source trees (from the input XML documents), one instruction tree (from the XSLT document), and one result tree. . . . The source trees represent the XML documents, the instruction tree represents the XSLT document holding all instructions for the transformation. It tells the XSLT processor how to transf orm the source trees and how to produce the result tree" (p. 89).
Chapter 6, "Transformation," explores how transformations are performed in XSLT. Fung examines the internal operations of an XSLT processor as it uses the information in the instruction tree to transform the source trees into the result tree. Fung effectively uses diagrams to create a "visual description" of the concept of these transformations. Chapters 7 through 10 delve more deeply into transformations, exploring such areas as constructing the result tree, combining templates, and using extension functions.
Part III begins with Chapter 11, "Idioms and tips," a helpful section that includes "pitfalls as well as shortcuts and conveniences" (p. 213) when using XSLT to transform XML documents. In this chapter, Fung covers generating tables, replacing characters throughout a text node, reusing XSLT documents from other projects, using XML configuration files, and much more. Chapter 12, "A case study," includes an extended example based on a project designed to produce a "Web site that serves only HTML pages with minimal database access" (p. 239). The site is intended to provide information for Java programmers and serve as a meeting place for them. This case study guides the reader through creating mockups of the Web pages, designing the XML files, and designing the XSLT templates that will generate the Web pages from the XML files.
Part IV consists of one chapter, "Transforming to XML and text," which briefly explores reasons and methods for transforming XML documents into other XML documents. This chapter is an overview that introduces such items as scalable vector graphics. As Fung mentions, transforming XML documents to other XML documents is a subject unto itself, and one to which many entire books are devoted.
XSLT: Working with XML and HTML is a solid source of information for those seeking to explore the nuts and bolts of transforming XML documents to HTML using XSLT. While the subject matter by its nature can sometimes be difficult for the nonprogrammer, the book's many examples and diagrams largely succeed in making the material understandable for the newcomer to XML and XSLT.
DAVID OWENS is a senior technical writer at Blackbaud, in Charleston, SC, where he uses single sourcing to create printed manuals and online help. He is the Webmaster for the South Carolina Lowcountry STC chapter and has copyedited books on topics ranging from German literature to football.