Creating Dynamic Pages with XSLT and XML

Dreamweaver’s XSLT server behavior processes all those “X” files and produces nothing but clean HTML for your visitors. To take advantage of this tool, you need to set up an application server as described in Chapter 23, so that you can run ASP, PHP, or ColdFusion pages.

Next, you need to either have an XML file in your site, or know the URL of an XML file out on the Web that you’d like to use—for example, http://feeds.feedburner.com/oreilly/news. One option is to create an entire XSLT page that includes the HTML that formats the page and the XML information you want to display. But this is generally an inefficient technique, since the server has to devote time and cycles to process the entire file (plain old HTML and all), and you can’t take advantage of Dreamweaver templates to enforce the look of your site.

Note

Note for PHP Users: For server-side XSLT to work, you need to use a version of PHP that supports XSLT. PHP 5 has this capability built in, but PHP 4 requires extra work to get this going. Fortunately, most web hosting companies offer PHP 5. So before moving ahead with your XML-fueled dynamic-page-creation efforts, call or email your hosting company to see if their PHP installation supports XSLT.

A better way to take advantage of Dreamweaver’s XML support is to display XML information in one of your site’s dynamic pages. To do that, you create what’s called an XSLT fragment, and you add a “chunk” of formatted XML to just one part of ...

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.