Mapping Nodes in Sample Files

This topic is part of a sequence that starts with Opening the XSLT Mapper.

To define links and examine the stylesheet Stylus Studio creates:
1. In the Mapper tab, expand the tree for both books.xml and catalog.xml.
2. In books.xml, place the pointer over the book repeating element.
3. Press and hold the left mouse button, and drag from book to the Book repeating element in catalog.xml.

Stylus Studio draws a line as you drag.

4. Release the mouse button to create the link between book and Book.

Stylus Studio creates an xsl:for-each block that links the book and Book repeating elements. (If you mouse over the block, xsl:for-each appears in a pop-up to indicate the XSLT operation represented by the link.)

Also notice that the complete xsl:for-each instruction has been added to the XSLT source, which appears in the XSLT source pane under the XSLT Mapper canvas. The back-mapping pointer identifies the line of XSLT that was just added to stylesheet.

The template contains an xsl:for-each instruction that selects the book element, which is the node you selected in step 2. The output from this template is an empty Book element, which is the node that was the target of the link. Stylus Studio created the Catalog element automatically, to provide the document structure necessary to support the Book element.

In the Output method: field, display the drop-down list and select xml. (Even if the setting for Output method is unspecified, Stylus Studio still generates XML.) Other choices for the output method include text and HTML.

6. Click the Mapper tab.

The xsl:output instruction is added to the XSLT source:

8. Click the XSLT Source tab to see the new instructions in the template. (If you prefer, you can simply adjust the splitter between the XSLT source pane and the XSLT Mapper canvas.
Free Stylus Studio XML Training:
W3C Member