When you open a mapping rule building area using the XSL Editor, the mapping rule building area is displayed in the XSL Editor main window.
In the XSL Editor main window, the left pane shows a hierarchical view of the source DTD that is labeled "Source Schema." The right pane shows a hierarchical view of the target DTD that is labeled "Target Schema."
Creating a mapping rule
Element-to-element mapping
Select and drag an element from the source hierarchy and drop it onto an element in the target hierarchy. An XSL rule is generated and displayed in the Mapping Rule view located at the bottom of the window.
Here is an example of a generated XSL rule:
<xsl:template match="merchant"> <xsl:element name="MERCHANT"> </xsl:element> </xsl:template>
Note: Any required but non-existing ancestor relationships are automatically generated.
Attribute-to-attribute mapping
Select and drag an attribute from the source hierarchy and drop it onto an attribute in the target hierarchy. An XSL rule is generated and displayed in the Mapping Rule view located at the bottom of the window.
Here is an example of a generated XSL rule:
<xsl:attribute name="MEADDR1"> <xsl:apply-templates select="@mecmail1"/> </xsl:attribute>
Note: Any required but non-existing ancestor relationships are automatically generated.
Creating a custom mapping expression
To create a custom mapping expression, first select an element or attribute from the target hierarchy. Then, right-click and select the Create Custom Expression menu. The Create Custom Expression window displays with a list of available Templates and Rule Expressions in two drop-down menus. Complete the custom expression by using the following steps:
- Select a template to which the custom expression is to be added.
- Select a rule expression to be created (Constant Expression for example).
- Type a value in the Value column for each parameter listed in the table, and press Enter to commit the value.
- Click OK to complete the creation step; or click Cancel to cancel without creating a rule.
The generated XSL rule is based on the custom expression defined in the rule-configuration file (XSLRuleConfig.xml). You can modify the rule-configuration file and add new rules if needed. To make a rule available for use in the Rule Expressions list, set the Visibility attribute for that rule to "true."
Deleting a mapping rule
To delete a mapping rule:
- Select a rule from the Mapping Rule table.
- Right-click, and select Delete.
The rule and all its descendents are deleted.
Note: The updated mapping rules and generated XSL rules are persisted automatically.
Processing an XML transformation
To process an XML transformation:
- Click Tools > Transform to bring up the Process Transform window.
- Complete the required fields:
- In the Input XML File field, type or browse to the path and name of the source XML data file.
- In the XSL Rule File field, type or browse to the path and name of the mapping-rule file to be used for the transformation.
If a mapping rule building area is open, this field is pre-filled with the mapping-rule file path currently open in the mapping rule building area.
- In the Output XML File field, type or browse to a path and name for the new XML data file to be created during the transformation process.
- Click Start to start the XML transformation process; or click Close to exit the window without processing a transformation.
Customizing the Mapping Rule table
To customize the Mapping Rule table:
- To hide a column in the table, right-click a cell in the table and select Hide column.
- To show a hidden column in the table:
- Right-click a cell in the table.
- Select Show columns to bring up the list of hidden columns.
- Select the column from the list.
Note: To select multiple columns, press and hold Shift then click the column names.
- Click OK to show the selected columns or Cancel to cancel the operation.
- To show all hidden columns in table, right-click a cell in the table and select Show all columns.
All columns are shown in the default order.
Displaying a complete XSL rule/value expression
From the Value Expression or XSL Rule columns, clicking a cell brings up a window with the completed rule content for the selected row.