Adding an <xsl:choose> instruction to your mapping

The following instructions were written for the Resource perspective, but they will also work in many other perspectives.

You can add an <xsl:choose> instruction to any target element or attribute in your XML to XML mapping. Follow these steps to do so:

  1. Open your mapping in the XML to XML mapping editor.

  2. Select the target attribute or element you want to work with.

  3. Click the toolbar button Add xsl:choose instruction .

  4. Click Add When to add an <xsl: when> condition, then select it.

  5. In the Test field, enter your XPath expression. You can enter it manually or create it using the XPath expression wizard (click XPath to launch it).

  6. In the Content field, enter the content you want added to the result tree when the test condition comes true.

  7. Repeat steps 4-6 for any other <xsl: when> conditions you want to add.

  8. (Optional) Click Add Otherwise to add an <xsl:otherwise> condition, then select it.

    1. In the Content field, enter the content you want added to the result tree if none of the other <xsl: when> elements are true. You cannot specify a test condition.

  9. The grayed out area shows the contents of the <xsl: choose> statement. You cannot edit it directly there. To edit a condition, select it and edit the fields as necessary.

    1. To remove a condition, select it and click Remove.

  10. When you are finished with your <xsl:choose> element, click Finish.

The <xsl:choose> instruction appears in the Overview pane next to the target element or attribute.

To remove it, select it in the Overview pane and click Mapping > Delete XSL Choose

 

Parent topic

Editing an XML to XML mapping