Adding an Instruction Block to the XSLT Mapper



If you enter an XSLT instruction in the XSLT source and that instruction can be graphically represented in the mapper, the instruction, including appropriate links to source and target nodes, appears the next time you display the Mapper tab.

To add an instruction block to the XSLT mapper
1. Right click on the mapper canvas.

The shortcut menu appears.

2. Select XSLT Instructions from the shortcut menu.

The XSLT Instructions submenu appears.

3. Select the instruction you want to add to your XSLT.

The block for the instruction you selected appears in the mapper canvas.

4. Provide a value for the input port(s). See Specifying Values for Ports if you need help with this step.
5. Link the output port(s).
6. Optionally, link the flow port.

Notes About Creating Instruction Blocks

Be aware of the following when working with XSLT instruction blocks in the XSLT mapper:

  • To simplify the mapper's appearance, Stylus Studio sometimes removes blocks from the mapper canvas and replaces them with a simple link. For example, imagine creating an xsl:value-of instruction block and linking source and target document nodes. Stylus Studio displays the instruction block, but if you leave the Mapper and later return to it, the block symbol for the xsl:value-of instruction is replaced by a link with a small circle at its center, link the one shown in Figure 243.

    Figure 243. xsl:value-of in XSLT Mapper

If you mouse over the circle, Stylus Studio displays the XSLT represented by the link ( xsl:value-of select="/books/book/@pubdate"/, for example).

This behavior also exists for text blocks created in the mapper that are not also linked to other blocks in the mapper. See Setting a Text Value.

  • If you type an XSLT instruction in the XSLT source that is not represented by the XSLT mapper, no representation of that XSLT instruction is displayed on the Mapper tab. The code remains as part of the XSLT source, however.
  • If you start creating an XSLT instruction in the mapper but do not completely define it (say you specify only the input port for an xsl:for-each instruction, for example), it is not represented in the XSLT source, and it is removed from the XSLT mapper if you leave the Mapper tab and then return to it.
Free Stylus Studio XML Training:
W3C Member