Inserting and Formatting XML

Now you know the basics of creating and using XSLT style sheets. But how do you actually add and format XML data? Dreamweaver makes it easy. If you’ve used the program’s database tools, you already know how to do it: just use the Bindings panel. Once you create an XSL file and attach the XML file to it, Dreamweaver reads all the tags in the XML file and adds them to the Bindings panel (see Figure 27-5).

You can drag any element in the Bindings panel into your XSLT style sheet page, just as you’d drag information from a database recordset. That means you can place XML information in a table cell, a footer, or a banner—anywhere you can place regular HTML elements on a page.

When you use Dreamweaver’s XSLT tools, the Bindings panel lists all the tags and properties in the XML file you format. Dreamweaver includes a few visual clues about the XML file: < > represents an XML tag and is the most common icon you’ll encounter; the @ sign represents a tag property (also called an attribute; for example, in the tag <rss version="2.0">, “version” is an attribute); and next to some tags, you’ll see a small + sign (circled in this image) or a ?. The + indicates that the tag is repeated multiple times; for example, an RSS feed usually has multiple news items, so in the feed’s XML file each news item will have its own tag. The ? (not shown here) means the tag is optional, and it appears next to tags inside of other repeated tags (the ones with the +).

Figure 27-3. When you use Dreamweaver’s XSLT tools, the Bindings panel lists all the tags and properties in the XML file you format. Dreamweaver includes a few visual clues about the XML file: < > represents an XML tag and is the most common icon you’ll encounter; the @ sign represents a tag property (also called an attribute; for example, in the tag <rss version="2.0">, “version” is an attribute); and next to some tags, you’ll see a small + sign (circled in this image) or a ?. The + indicates that the tag is repeated multiple times; for example, an RSS feed usually has multiple news items, so in the feed’s XML file each news item will have its own tag. The ? (not shown here) means the ...

Get Dreamweaver CS5: The Missing Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.