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:
- Open your mapping in the XML to XML mapping editor.
- Select the target attribute or element you want to work with.
- Click the toolbar button Add xsl:choose instruction .
- Click Add When to add an <xsl: when> condition, then select it.
- 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).
- In the Content field, enter the content you want added to the result tree when the test condition comes true.
- Repeat steps 4-6 for any other <xsl: when> conditions you want to add.
- (Optional) Click Add Otherwise to add an <xsl:otherwise> condition, then select it.
- 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.
- 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.
- To remove a condition, select it and click Remove.
- 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