XSLT For Dummies
eBook - ePub

XSLT For Dummies

  1. English
  2. ePUB (mobile friendly)
  3. Available on iOS & Android
eBook - ePub

XSLT For Dummies

About this book

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.

Tools to learn more effectively

Saving Books

Saving Books

Keyword Search

Keyword Search

Annotating Text

Annotating Text

Listen to it instead

Listen to it instead

Information

Part I

Getting Started with XSLT

In this part . . .
**IN a DROPCAP**
Y ou watched the X-Files and then you saw X-Men on the big screen, but these were only warm-ups for the real deal — the X-Team. In this part, you find out all about the X-Team members, including XML, XSL, XSLT, and XPath, and how they work together. You also get your feet wet by transforming your first XML document using XSLT.
Chapter 1

Introducing the X-Team

In This Chapter

bullet
Finding out about XML, XSL, XSLT, and XPath
bullet
Knowing the difference between XSL and XSLT
bullet
Looking at the X-Team from an HTML perspective
A s a sports fan, I enjoy watching all kinds of team sports, whether football, basketball, baseball, or an Olympic team competition. I’ve noticed that regardless of the sport, great teams have two things in common. First, they have very talented individuals on them. Second, they function well as a team; I find hardly anything more thrilling in sports than seeing a squad of talented athletes working together cohesively. (Of course, it goes without saying that the most exciting part of sports is the “I’m going to Disneyworld” commercials!)
Although this book focuses on eXtensible Stylesheet Language Transformations, or XSLT, you’ll quickly discover that XSLT is an important component of a closely related set of technologies that I affectionately call the X-Team. This “Dream X-Team” consists of: XML, XSL, XSLT, and XPath. (For the techies out there, that’s shorthand for eXtensible Markup Language, eXtensible Stylesheet Language, XSL Transformations, and XML Path Language.) Each of these technologies is powerful, but each gets its true strength through interrelationships. So, although I concentrate much of the attention in this book on XSLT, never think of it as something independent of its teammates.
As you start your XSLT journey, I begin by introducing you to the X-Team members, each of which has a separate but intertwined responsibility.

XML: Storing Your Data

The original member of the X-Team is eXtensible Markup Language (XML), the granddaddy of them all. All other X-Team members are designed to work with or act upon XML. A relatively recent innovation, XML was conceived primarily by Jon Bosak as a way to make working with information delivered over the Web easier. Then in 1998, XML was standardized by the World Wide Web Consortium (W3C), the international standards body for the Web.
Since its beginnings, the Web has used HyperText Markup Language (HTML) to display content. HTML documents are stored on Web servers and then sent on demand to a Web browser, such as Microsoft Internet Explorer or Netscape Navigator. The browser then displays the HTML as a Web page. Figure 1-1 illustrates this process.
Figure 1-1: Displaying information over the Web.
Figure 1-1: Displaying information over the Web.

HTML comes up short

HTML has become so wildly popular largely because it’s very easy to learn and work with; heck, even my 7-year-old can create a Web page using Microsoft FrontPage, and my 9-year-old can write HTML by hand. The markup language was originally designed purely as a way to format and lay out information. However, because people have wanted to use the Web for nearly every task under the sun, HTML has been forced to do far more than was ever intended.
Consider a familiar scenario: A company wants to put information stored in a database onto its Web site. A sampling of its data might look something like Table 1-1.
Table 1-1
To present t...

Table of contents

  1. Title
  2. Contents
  3. Introduction
  4. Part I : Getting Started with XSLT
  5. Chapter 1: Introducing the X-Team
  6. Chapter 2: Writing Your First XSLT Stylesheet
  7. Part II : Becoming an XSLT Transformer
  8. Chapter 3: Transforming with Style (Stylesheets, That Is)
  9. Chapter 4: Templates Rule!
  10. Chapter 5: XPath Espresso
  11. Chapter 6: We Want Results!
  12. Part III : Prime Time XSLT
  13. Chapter 7: Adding Programming Logic Isn’t Just for Propheads
  14. Chapter 8: Variables in XSLT: A Breed Apart
  15. Chapter 9: Tweaking the Results to Get What You Want
  16. Chapter 10: To HTML and Beyond!
  17. Chapter 11: XPath Data Types and Functions
  18. Part IV : eXtreme XSLT
  19. Chapter 12: Combining XSLT Stylesheets
  20. Chapter 13: “Gimme Some Space” and Other Output Issues
  21. Chapter 14: Keys and Cross-Referencing
  22. Chapter 15: Namespaces Revisited
  23. Chapter 16: Extending XSLT
  24. Chapter 17: Debugging XSLT Transformations
  25. Part V : The Part of Tens
  26. Chapter 18: Ten Most Confusing Things About XSLT
  27. Chapter 19: Ten All-Pro XSLT Resources on the Web
  28. Chapter 20: Ten XSLT Processors Available Online
  29. Glossary

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access XSLT For Dummies by Richard Wagner in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming Languages. We have over one million books available in our catalogue for you to explore.