XSLT is a complex language with lots of bells and whistles—and just as many pitfalls. It’s all too easy to head ambitiously into Code view and, with just a few keystrokes, completely break your XSLT style sheet. But since Dreamweaver’s XSLT tools take you only so far, you’ll undoubtedly find yourself wanting to dip into the code. Here are a couple of examples to help your explorations go a little more smoothly.
The Repeat Region feature normally works by spitting out data it retrieves from an XML document in the order it appears in the XML file. In the case of an RSS feed, that’s usually OK, since RSS feed usually sort items in chronological order, with the most recent feed first. But what if you want information sorted another way, or you have an XML file with other kinds of data, like the employee listing on Inserting a Repeat Region? In that example, you might want employees listed in alphabetical order. Dreamweaver doesn’t have a tool that lets you do this. Fortunately, adding the code yourself is pretty easy:
Click inside a repeat region and then click the “Code” or “Split” button in the document window’s toolbar.
Alternatively, you can choose View→Code or View→“Code and Design”. Doing so drops you into the scary world of XSLT code.
Locate the beginning of the repeat region.
You’re looking for something like this: <xsl:for-each select="company-Info/employeeList/employee">, where the stuff in quotes after “select” is the XPath expression ...