Display repeating xml elements – Adobe Dreamweaver CC 2015 User Manual
Page 522

515
XML
Last updated 6/3/2015
An XML data placeholder appears on the page. The placeholder is highlighted and in curly brackets. It uses the
XPath (XML Path language) syntax to describe the hierarchical structure of the XML schema. For example, if you
drag the child element title to the page, and that element has the parent elements rss, channel, and item, then the
syntax for the dynamic content placeholder will be {rss/channel/item/title}.
Double-click the XML data placeholder on the page to open the XPath Expression Builder. The XPath Expression
Builder lets you format selected data, or select other items from the XML schema.
4
(Optional) Apply styles to your XML data by selecting an XML data placeholder and applying styles to it like any
other piece of content using the Property inspector or the CSS Styles panel. Alternatively, you can use Design-time
style sheets to apply styles to XSLT fragments. Each of these methods has its own set of benefits and limitations.
5
Preview your work in a browser (File > Preview in Browser).
Note: When you preview your work using Preview in Browser, Dreamweaver performs an internal XSL transformation
without the use of an application server.
Display repeating XML elements
The Repeating 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 changed to a repeated region. However, the
most common regions are tables, table rows, or a series of table rows.
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.
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 tag in the tag selector.
2
Do one of the following
• Select Insert > XSLT Objects > Repeating Region.
• In the XSLT category of the Insert panel, click the Repeating Region button.
3
In the XPath Expression Builder, select the repeating element, indicated by a small plus sign.