XSLT for Dummies

Book description

Restructuring information in an XML document so that it works in other formats used to be a time-consuming ordeal involving lots of blood, sweat, and tears. Now XSLT (Extensible Stylesheet Language Transformations) makes the process nearly instantaneous. Just provide an example of the kind of information you'd like to see, and XSLT does the rest. With XSLT you can effortlessly transform XML documents into virtually any kind of output, including other XML documents and HTML pages. But mastering XSLT can be tricky, especially if you've never worked with XML or HTML; and most books on the subject are written for people who have. Here comes XSLT For Dummies to the rescue!

XSLT For Dummies is your ticket to quickly mastering XSLT—no matter what your prior programming experience. Writing in easygoing, plain English, XML pro Richard Wagner provides expert advice, step-by-step guidance, and tons of crystal-clear examples to help you harness the power of XSLT to transform documen ts. In no time you'll:

  • Understand how XSLT works with XSL and XPath

  • Experiment with templates, stylesheets, and expressions

  • Perform HTML transformations

  • Master XPath data types and functions

  • Combine XSLT stylesheets

  • Explore cool XSLT programming tricks

XSLT For Dummies works from the ground up, starting with a practical introduction of the "X-Team"—XML, XSL, XSLT, and X-Path—and instructions on how to write a XSLT stylesheet. From there it quickly moves onward and upward through the whole range of important XSLT topics, including:

  • Transforming with stylesheets

  • Understanding and using template rules

  • Using XPath to locate nodes in XML documents

  • Combining XSLT stylesheets and adding processing instructions

  • Debugging XSLT transformations

  • Ten XSLT processors available online

It doesn't matter whether you're a babe in the woods who can't tell a "tag" from an element, or you're an old pro at creating XML documents, XSLT For Dummies offers you a fun, easy way to explore and take full advantage of Extensible Stylesheet Language Transformations.

Table of contents

  1. Title
  2. Contents
  3. Introduction
    1. What I Assume About You
    2. How This Book Is Organized
    3. Conventions Used in This Book
    4. Icons Used in This Book
  4. Part I : Getting Started with XSLT
  5. Chapter 1: Introducing the X-Team
    1. XML: Storing Your Data
    2. XSL: Presenting XML Data
    3. XSLT: Transforming Your XML Data
    4. XPath: Seeking Out Your Data
    5. The X-Team through HTML Eyes
  6. Chapter 2: Writing Your First XSLT Stylesheet
    1. Preparing Your XSLT Working Environment
    2. Creating a Simple XML Document
    3. Knowing the End Result
    4. Writing an XSLT Stylesheet
    5. Processing the Stylesheet
    6. Viewing the Results
  7. Part II : Becoming an XSLT Transformer
  8. Chapter 3: Transforming with Style (Stylesheets, That Is)
    1. Structure of a Stylesheet
    2. Constructing Your XSLT Stylesheet
    3. What’s in a Name(space)?
    4. Documents as Trees
  9. Chapter 4: Templates Rule!
    1. A Glorified Mail Merge
    2. Basics of a Template Rule
    3. Common Action Instructions
    4. Built-In Template Rules
    5. Matchmaker, Make Me a Match
    6. Working with Attribute Value Templates
    7. Working with Named Templates
  10. Chapter 5: XPath Espresso
    1. XPath, The X-Team’s Commando
    2. Dancing the Location Step
    3. Defining Relationships with Axes
    4. Matching Nodes with Node Tests
    5. Using Predicates to Get Specific
    6. Take a Walk on the Absolute Side
    7. Putting It All Together
  11. Chapter 6: We Want Results!
    1. XSLT, Like Skinning a Cat
    2. XML Source
    3. Copying an Element
    4. Copying All Elements
    5. Adding a New Element
    6. Adding a Calculated Value
    7. Renaming an Element
    8. Removing an Element
    9. Removing an Attribute
    10. Reordering Elements
    11. Merging Elements
    12. Adding Attributes
    13. Moving an Attribute
    14. Converting Elements into Attributes
    15. Converting Attributes into Elements
  12. Part III : Prime Time XSLT
  13. Chapter 7: Adding Programming Logic Isn’t Just for Propheads
    1. Conditional and Looping Statements
    2. If and Only If
    3. Testing Expressions with Logical Operators
    4. Why Choosy People Choose xsl:choose
    5. Going Loopy with xsl:for-each
  14. Chapter 8: Variables in XSLT: A Breed Apart
    1. What Is a Variable?
    2. Setting Variables
    3. Uses of Variables
    4. Think Globally, Act Locally
    5. Working with Parameters
  15. Chapter 9: Tweaking the Results to Get What You Want
    1. Sorting Elements in the Results Tree
    2. Adding Automatic Numbering
  16. Chapter 10: To HTML and Beyond!
    1. XML and HTML
    2. Outputting to HTML
    3. Creating an HTML Table
    4. Linking an XSLT Stylesheet with an XML Document
    5. Browser Support of XSLT
    6. To Infinity and Beyond (Into Other Formats)
  17. Chapter 11: XPath Data Types and Functions
    1. Playing ‘Heart and Soul’ with Nodes
    2. Working with Strings
    3. Numerically Speaking
    4. Booleans: To Be or Not to Be
    5. General Purpose Functions
  18. Part IV : eXtreme XSLT
  19. Chapter 12: Combining XSLT Stylesheets
    1. Comparing xsl:include and xsl:import
    2. Practical Use of xsl:import
  20. Chapter 13: “Gimme Some Space” and Other Output Issues
    1. Gimme Some Space
    2. Indenting Your Result Document
    3. Adding Comments
    4. Adding Processing Instructions
  21. Chapter 14: Keys and Cross-Referencing
    1. Keys to the Kingdom
    2. Using Keys with Multiple Source Documents
  22. Chapter 15: Namespaces Revisited
    1. Speaking the Namespace Lingo
    2. Adding a Namespace to the Result Document
    3. Working with Multiple Namespaces
  23. Chapter 16: Extending XSLT
    1. Going Beyond the Basics
    2. Using an Extension Element
    3. Using an Extension Function
    4. Ensuring Portability of Your Stylesheets
  24. Chapter 17: Debugging XSLT Transformations
    1. Conditionally Halting Execution
    2. Adding a Conditional Debug Mode
    3. Tracing through Your Code
    4. More Powerful Debugging
  25. Part V : The Part of Tens
  26. Chapter 18: Ten Most Confusing Things About XSLT
    1. Built-In Template: The Man Behind the Screen
    2. Thar’s Trees in Them Documents
    3. Getting to the Root of the Issue
    4. Why the Selected Node Is Not the Same as the Current Node
    5. Those //@.}* Abbreviations
    6. To Apply or Copy, That Is the Question
    7. Walk This Way
    8. Expressions, Paths, and Steps
    9. Those Cute Little Curly Braces
    10. Whitespace, the Final Frontier
  27. Chapter 19: Ten All-Pro XSLT Resources on the Web
    1. Xslt.com
    2. W3C XSLT Recommendation
    3. W3C XPath Recommendation
    4. Dave Pawson’s XSLT FAQ
    5. W3School’s XSL School
    6. MSDN’s XML Center
    7. Xml101.com
    8. Jeni’s XSLT Pages
    9. TopXML: XSLT Reference
    10. Nic Miloslav’s XSLT Tutorial
  28. Chapter 20: Ten XSLT Processors Available Online
    1. Saxon
    2. msxsl
    3. Sablotron
    4. Xalan-C++
    5. Xalan-Java
    6. LotusXSL
    7. XT
    8. jd.xslt
    9. XML::XSLT
    10. libxslt
  29. Glossary

Product information

  • Title: XSLT for Dummies
  • Author(s): Richard Wagner
  • Release date: March 2002
  • Publisher(s): For Dummies
  • ISBN: 9780764536519