Insert and Populate a Table

Next, we add a table based on the video repeating element and populate its columns.

5. Expand the videos node.
6. Drag the video repeating element from the data sources panel and drop it on the XML Publisher canvas.
7. Select Insert Table > Empty from the short-cut menu.

Stylus Studio creates a three-column table. At this point, the XML Publisher Editor should resemble Figure 528:

Although the table currently contains no values, if you mouse over the repeating glyph at the left of the table ( ) you will see that it references the videos.xml document and that the current XPath expression evaluates the video repeating element (/result/videos/video).

8. Right-click any cell in the table and select Remove Column from the short-cut menu.
9. Expand the video node in the data sources panel.
10. Drag the title node and drop it in the first column; select Insert Value from the short-cut menu.

A value glyph with the element name appears in the cell.

11. Repeat this step with the rating element, dropping it in the second column.
12. Right-click the table again, and select Add Row Before.

Stylus Studio adds a new row to the table. Note that the new row does not repeat - the repeating glyph is associated only with the second row, the row that contains the data.

13. Type Title in the first column and Rating in the second.
14. Click Preview ( ).

Stylus Studio creates a three-column table. At this point, your XML Publisher Editor should resemble this:

Free Stylus Studio XML Training:
W3C Member