Displaying repeating XML elements
The Repeat Region XSLT object lets you display repeating elements from an XML data source in a web page. For example, if you are displaying article titles and descriptions from a news feed, and that news feed contains between 10 and 20 articles, each title and description in the XML file would probably be a child element of a repeating element.
Any region in Design view containing an XML data placeholder can be turned into a repeated region. However, the most common regions are tables, table rows, or a series of table rows.
To learn more about how the Repeat Region XSLT object works with XML data, see About XML data and repeating elements.
To display repeating XML elements:
- In Design view, select a region that contains an XML data placeholder or placeholders.
The selection can be anything, including a table, a table row, or even a paragraph of text.
To select a region on the page precisely, you can use the tag selector in the lower-left corner of the Document window. For example, if the region is a table, click inside the table on the page, and then click the
<table> tag in the tag selector.
- Do one of the following
- Select Insert > XSLT Objects > Repeat Region.
- In the XSLT category of the Insert bar, click the Repeat Region button.
- In the XPath Expression Builder, select the repeating element, indicated by a small plus sign.
For more information, click the Help button in the dialog box.
- Click OK.
In the Document window, a thin, tabbed, gray outline appears around the repeated region. When you preview your work in a browser (File > Preview in Browser), the gray outline disappears and the selection expands to display the specified repeating elements in the XML file.
Youll also notice that when you add the Repeat Region XSLT object to the page, Dreamweaver truncates the length of the XML data placeholder in the Document window. This is because Dreamweaver updates the XPath for the XML data placeholder so that it is relative to the path of the repeating element.
For more information, see About XML data and repeating elements.
- Editing a Repeat Region XSLT object
- About using XML and XSL with web pages
- Performing XSL transformations on the server
- Setting XPath Expression Builder (Dynamic Text) dialog box options