Synopses & Reviews
XSLT is a powerful language for transforming XML documents into something else. That something else can be an HTML document, another XML document, a Portable Document Format (PDF) file, a Scalable Vector Graphics (SVG) file, a Virtual Reality Modeling Language (VRML) file, Java code, or a number of other things. You write an XSLT stylesheet to define the rules for transforming an XML document, and the XSLT processor does the work.As useful as XSLT is, its peculiar characteristics make it a difficult language in which to get started. In fact, newcomers are often a little dazed on first contact. Learning XSLT offers a hands-on introduction to help them get up to speed with XSLT quickly. The book will help web developers and designers understand this powerful but often mystifying template-driven and functional-styled language, getting them over the many differences between XSLT and the more conventional programming languages.Learning XSLT moves smoothly from the simple to complex, illustrating all aspects of XSLT 1.0 through step-by-step examples that you'll practice as you work through the book. Thorough in its coverage of the language, the book makes few assumptions about what you may already know. You'll learn about XSLT's template-based syntax, how XSLT templates work with each other, and gain an understanding of XSLT variables. Learning XSLT also explains how the XML Path Language (XPath) is used by XSLT and provides a glimpse of what the future holds for XSLT 2.0 and XPath 2.0.The ability to transform one XML vocabulary to another is fundamental to exploiting the power of XML. Learning XSLT is a carefully paced, example-rich introduction to XSLT that will have you understanding and using XSLT on your own in no time.
About the Author
Michael Fitzgerald is Principal at Overdue Books LLC, a publishing and writing firm. He is the author of Learning Ruby, Ruby Pocket Reference, XML Pocket Reference, Third Edition with Simon St. Laurent, XML Hacks, and Learning XSLT, all published by O'Reilly. He is also the author of Building B2B Applications with XML: A Resource Guide and XSL Essentials (both by John Wiley & Sons). His books have been translated into Spanish, French, German, Japanese, and Chinese. He has also been a regular contributor to XML.com. Michael likes to ski (downhill and cross country), ride and train horses, and spend time with his family.
Table of Contents
Preface; Who Should Read This Book?; About the Examples; XSLT and XPath Reference; How This Book Is Organized; Conventions Used in This Book; Using Examples; Comments and Questions; Acknowledgments; Chapter 1: Transforming Documents with XSLT; 1.1 How XSLT Works; 1.2 Using Client-Side XSLT in a Browser; 1.3 Using apply-templates; 1.4 Summary; Chapter 2: Building New Documents with XSLT; 2.1 Outputting Text; 2.2 Literal Result Elements; 2.3 Using the Element Called element; 2.4 Adding Attributes; 2.5 Outputting Comments; 2.6 Outputting Processing Instructions; 2.7 One Final Example; 2.8 Summary; Chapter 3: Controlling Output; 3.1 The Output Method; 3.2 Outputting XML; 3.3 Outputting HTML; 3.4 Outputting Text; 3.5 Using a QName Output Method; 3.6 Media Types; 3.7 Summary; Chapter 4: Traversing the Tree; 4.1 The XPath Data Model; 4.2 Location Paths; 4.3 Expressions; 4.4 What Is a Pattern?; 4.5 Predicates; 4.6 Axes; 4.7 Name and Node Tests; 4.8 Doing the Math with Expressions; 4.9 Summary; Chapter 5: XPath and XSLT Functions; 5.1 Boolean Functions; 5.2 Node-Set Functions; 5.3 Number Functions; 5.4 String Functions; 5.5 Summary; Chapter 6: Copying Nodes; 6.1 The copy Element; 6.2 The copy-of Element; 6.3 Copying Nodes from Two Documents; 6.4 Summary; Chapter 7: Using Variables and Parameters; 7.1 Defining Variables and Parameters; 7.2 Using Variables; 7.3 Using Parameters; 7.4 Invoking Templates with Parameters; 7.5 Using Result Tree Fragments; 7.6 Summary; Chapter 8: Sorting Things Out; 8.1 Simple Ascending Sort; 8.2 Reversing the Sort; 8.3 By the Numbers; 8.4 Multiple Sorts; 8.5 The lang and case-order Attributes; 8.6 Summary; Chapter 9: Numbering Lists; 9.1 Numbered Lists; 9.2 Alphabetical Lists; 9.3 Roman Numerals; 9.4 Inserting an Individual Formatted Value; 9.5 Numbering Levels; 9.6 The from Attribute; 9.7 The lang and letter-value Attributes; 9.8 More Help with Formatted Numbers; 9.9 Summary; Chapter 10: Templates; 10.1 Template Priority; 10.2 Calling a Named Template; 10.3 Using Templates with Parameters; 10.4 Modes; 10.5 Built-in Template Rules; 10.6 Summary; Chapter 11: Using Keys; 11.1 A Simple Key; 11.2 More Than One Key; 11.3 Using a Parameter with Keys; 11.4 Cross-Referencing with Keys; 11.5 Grouping with Keys; 11.6 Summary; Chapter 12: Conditional Processing; 12.1 The if Element; 12.2 The choose and when Elements; 12.3 Summary; Chapter 13: Working with Multiple Documents; 13.1 Including Stylesheets; 13.2 Importing Stylesheets; 13.3 Using the document( ) Function; 13.4 Summary; Chapter 14: Alternative Stylesheets; 14.1 A Literal Result Element Stylesheet; 14.2 An Embedded Stylesheet; 14.3 Aliasing a Namespace; 14.4 Excluding Namespaces; 14.5 Summary; Chapter 15: Extensions; 15.1 Xalan, Saxon, and EXSLT Extensions; 15.2 Using a Saxon Extension Attribute; 15.3 Result Tree Fragment to Node-Set; 15.4 Using EXSLT; 15.5 Fallback Behavior; 15.6 Checking for Extension Availability; 15.7 Summary; Chapter 16: XSLT 2.0 and XPath 2.0; 16.1 New XSLT 2.0 Features; 16.2 New XPath 2.0 Features; 16.3 Multiple Result Trees; 16.4 Using Regular Expressions; 16.5 Grouping in XSLT 2.0; 16.6 Extension Functions; 16.7 Summary; Chapter 17: Writing an XSLT ProcessorInterface; 17.1 Running an XSLT Processor from Java; 17.2 Writing an XSLT Processor with C#; 17.3 Summary; Chapter 18: Parting Words; 18.1 The Ox Documentation Tool; 18.2 Signing Off; Appendix A: XSLT Processors; A.1 Installing and Running XSLT Processors; A.2 Using jd.xslt; Glossary; Colophon;