Insert and Populate a Table

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

4. Expand the videos node.
5. Drag the video repeating element from the data sources panel and drop it on the XML Publisher canvas.
6. 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 484:

Figure 484. Default Table in New XML Publisher Report

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

7. Right-click any cell in the table and select Remove Column from the short-cut menu.
8. Expand the video node in the data sources panel.
9. 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.

10. Repeat this step with the rating element, dropping it in the second column.
11. 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.

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

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

Figure 485. Preview of XML Publisher Report

14. Click the Hide docked window button (the small X) to close the Preview window. This gives us more room to work, and Stylus Studio will automatically display the Preview window the next time we preview the report.
 
Free Stylus Studio XML Training: