Introduction

Everyone seems to be talking about Extensible Markup Language (XML) these days. You know how mothers are — I can’t even visit my relatives over the holidays without my mom broaching the topic of XML at Thanksgiving dinner. Yes, XML has become quite a buzzword, but Extensible Stylesheet Language Transformations (XSLT) is the power that takes all this XML and turns it into something useful and flexible.

XSLT is a language used to transform XML documents into something new. It can take one XML document and output that document’s information into a completely different structure or turn XML into an HTML document for viewing on the Web. XSLT isn’t a general-purpose programming language, such as Java or Visual Basic; its focus is solely on transforming XML.

Before I get any farther along, I have to point out the “elephant in the room” — XSLT’s long-winded name. Who came up with that name anyway? I think the people responsible should be forced to say, “Extensible Stylesheet Language Transformations,” aloud ten times and hope their tongues don’t fall off! XSLT’s full name may be a mouthful, but this book carves up each piece of XSLT into manageable, chewable morsels.

XSLT can be confusing if you don’t have a solid understanding of its syntax, quirky abbreviations, and the esoteric terminology it sometimes uses. But XSLT For Dummies can help you write XSLT stylesheets and, just as important, grasp why and how transformations work. In addition, see www.dummies.com/extras/xsltfd for code examples as well as a helpful editing tool of my own creation which I call the X-Factor.

Above all, you can use XSLT For Dummies as your guide for quickly developing the know-how of XSLT — without drowning in technical gobbledygook.

What I Assume About You

XSLT For Dummies starts from the bottom and works its way up: It doesn’t assume that you have any previous knowledge of XSLT or XML. If you have some know-how of HTML or programming, I think you can grasp some of the concepts of XSLT quicker than a beginner, but I don’t expect you to know HTML or anything about programming beforehand.

How This Book Is Organized

My aim is to help you find out how to become productive with XSLT quickly so that you can transform XML documents into virtually any kind of output imaginable. With that goal in mind, XSLT For Dummies is divided into five parts, each of which builds upon the previous ones.

Part I: Getting Started with XSLT

Part I kicks off your journey. You start by finding out about the core concepts of XSLT and how it fits in with HTML and all the other X technologies out there, such as XML, XSL, and XPath. You get your feet wet by writing your first XSLT stylesheet and transforming an XML document.

After you finish that, you can say XSLT to your buddies at work and actually have a grasp of what you’re talking about when you throw around those X terms.

Part II: Becoming an XSLT Transformer

This part takes you into the belly of the beast: stylesheets, template rules, and XPath expressions. But don’t worry — you won’t lose your appetite. You begin by looking at stylesheets and find out, in everyday terms, the often-confusing subject of document trees and recursion. From there, you start pulling information out of XML documents and outputting it into various forms.

By the time you’re done with this part, you’ll be able to say, “Extensible Stylesheet Language Transformations,” without stumbling over any of the twelve syllables.

Part III: Prime Time XSLT

In this part, you dive deeper into the thick of things. You find out how XSLT handles programming concepts such as if/then statements, loops, and variables, and how to include them in stylesheets. Don’t worry if you’ve never programmed before; these concepts become clear as you read through the chapters. You also find out about how to take advantage of the more advanced capabilities of XSLT and XPath to create more powerful transformations.

I predict that after you finish this part, at least once you’ll have unintentionally ordered an XSLT sandwich on rye at your local deli.

Part IV: eXtreme XSLT

As you read through Part IV, you can begin to call yourself a bona fide XSLT Transformer. You find out how to create effective XSLT stylesheets and apply them under various conditions. You find out about how to combine stylesheets and even add your own extensions. You also get the inside scoop on debugging transformations.

A word of warning: By now, all this XSLT will be swimming around in your head. You may find yourself mingling at a social event and leading with the line: “Apply any good templates lately?”

Part V: The Part Of Tens

In this part, I guide you through some practical tips and information that can make your life easier when you work with XSLT. I start out by demystifying the ten most confusing things about XSLT. Then I detail what I consider to be the ten best XSLT resources on the Web. I conclude by giving you the details on ten XSLT processors that you can download online.

Conventions Used in This Book

Snippets of XSLT code are scattered throughout the book and are often used to introduce you to a feature of the markup language. They appear in the chapters like this:

<xsl:stylesheet xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” version=”1.0”> 

  <xsl:template match=”id”> 

     <h1><xsl:apply-templates/></h1>

  </xsl:template>  

 

</xsl:stylesheet> 

If you type these stylesheets by hand, pay close attention and type the text exactly as shown to ensure that the stylesheet transforms properly. Generally, spaces don’t matter much, although depending on where they are, they could change the look of the output from a transformation. However, case sensitivity is important for any XML or XSLT element. I use lowercase text in all the examples, so I recommend getting used to typing lowercase to avoid confusion or problems down the line.

If XSLT element names or instructions appear within the regular text, they look like this.

Icons Used in This Book

Tip

Tips draw attention to key points that can save you time and effort.

Remember

Pay close attention to this icon; it highlights something that’s important to your understanding of XSLT or how to use it.

Warning(bomb)

Heed the Warning icon because it can save you from the pitfalls of XSLT pain and agony.

TechnicalStuff

Technical Stuff is the techno-mumbo-jumbo that’s interesting but probably only for geeks. So, reading these sections can provide useful information, but feel free to skip them.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.137.240