Displaying repeating XML elements

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:

  1. 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.

    This is a picture of the feature being described.

  2. Do one of the following
    • Select Insert > XSLT Objects > Repeat Region.
    • In the XSLT category of the Insert bar, click the Repeat Region button.
  3. In the XPath Expression Builder, select the repeating element, indicated by a small plus sign.

    This is a picture of the feature being described.

    For more information, click the Help button in the dialog box.

  4. 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.

    You’ll 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.

Related topics

  • 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


Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Laying Out Pages
Adding Content to Pages
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Defining Sources of Dynamic Content
Developing Applications Rapidly