Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Corrected links that should have been relative instead of absolute.

You can set various properties of a target element.

Steps to set target element properties

  1. Ensure that the source and target schemas are loaded and all their elements are listed under their respective nodes.
  2. Click the target element for which you want to set properties.
  3. Click the Node tab displayed in the Mapping Graph Area. All tabs of the Node tab are displayed.
  4. Click the Properties tab. The Properties pane is displayed (see Figure 548)

    Figure 548: Properties Pane

  5. The Properties pane comprises of various properties, which are outlined in the table below.

     Table 22: Properties of a Target Element

    Property

    Description

    XPath

    Displays the XPath of the selected target element. It is a read-only field.

    For Each

    Sets the For Each property for the target element. It is used to repeat occurrences of a target element depending on the total occurrences of a source element in the source file. To set the For Each property refer to the section Setting the For Each Property.

    Sorting

    Sets the Sorting rules for the target element. It also allows you to view or remove sorting rules for the target element. To set the Sorting Rules, refer to the section Setting Sorting Rules.

    Disable-Output-Escaping

    Sets the disable-output –escaping property for the target element. It is used to include this property under the 'value-of' element in the generated XSL. By default, this property is set as 'no'. For details on this property, refer to the section Using XSL Property.

    Comments

    Displays comments entered for the target element. This is a data entry field and allows you to enter comments for the target element. To enter comments, refer to the section Adding Comments for Target Element.

  6. Enter the properties required for the selected target element.
  7. Click Save Properties to save the properties entered for the target element. If you shift focus to another node, or click any of the Mapping Rules, Textual Rules, Global Variables, Properties, XSL or Debugger tabs, without saving the properties, an alert message is displayed (refer to Figure 522).

  8. Click No to save the properties and shift focus to the other object. If you click Yes, then the defined properties are cleared and the focus is shifted to the other object.


Anchor
FE
FE
Setting For Each Property
The For Each property is used to repeat the occurrences of a target element or node, depending on the total occurrences of a source element or a node in the source file.
For example, an XML schema with a node customer has three elements, first_name, last_name, and state. This schema is used both at the source and at the target end.

Supposing, the source file has 10 occurrences of the customer. Applying the For Each property on the target node customer, for the source node customer, generates an output file containing 10 occurrences of the customer in it.

...

Info

...

  • If For Each

...

  • property is not used, an output file is generated with only one occurrence of customer in it.

...

  • For Each

...

  • and Apply Template both cannot be used simultaneously on one node.

Steps to set the For Each property

  1. Ensure that the source and target schemas are loaded and all their elements are listed under their respective nodes.
  2. Click the target element for which you want to set the For Each property.
  3. Click the Node tab displayed in the Mapping Graph Area. All tabs of the Node tab are displayed.
  4. Click Properties tab. The Properties pane is displayed (refer to Figure 548).
  5. Click the For Each property field and then double-click the source element using which you want to apply the For Each property. This displays the entire path of the source element in the For Each field (see Figure 549).


    Figure 549: Source Element in For Each Property

     
    Info

    You can set

    the 

    the For Each

     property on

    property on more than one source element. You can use the | character as a separator between the XPath of each source element.

  6. Click Save Properties. This applies the For Each property for the selected target element. If you shift focus to another node, or click any of theMapping Rules, Textual Rules, Global Variables, Properties, XSL or Debugger tabs, without saving the For Each property, an alert message is displayed (refer to Figure 522).
  7. Click No to save the For Each property and shift focus to the other object. If you click Yes, then the defined For Each property is cleared and the focus is shifted to the other object. 
Info
  • Once

...

  • the For Each

...

  • property is applied to a target element, the

...

  • letter (F)

...

  • is displayed next to the target element. Refer

...

...

...

  • To remove

...

  • the For Each

...

  • property from the target element, right-

...

  • click target

...

  • element and

...

  • select Remove Mappings

...

  • option. This displays the Remove Mapping Options

...

  • dialog box. Select

...

  • the Remove For Each

...

  • checkbox and

...

  • click OK.

...

 

...

Adding Comments to Target Schema Elements
Comments are used to provide additional information to target nodes and elements. Comments are displayed as tool tips and are reflected in the XSL generated under the XSL tab.
 

Steps to add a comment to the target element

  1. Ensure that the source and target schemas are loaded and all their elements are listed under their respective nodes.
  2. Click the target element for which you want to add a comment.
  3. Click the Node tab displayed in the Mapping Graph Area. All tabs of the Node tab are displayed.
  4. Click the Properties tab. The Properties pane is displayed (refer to Figure 548).
  5. Click the Comments property field and enter the comment for the selected target element (see Figure 550).

    Figure 550: Enter Comment

  6. Click Save Properties. This adds the comment and displays it next to the target element. If you shift focus to another node, or click any of the Mapping Rules, Textual Rules, Global Variables, Properties, XSL or Debugger tabs, without saving the comments, an alert message is displayed (refer to Figure 522).
  7. Click No to save the comments and shift focus to the other object. If you click Yes, then the defined comments are cleared and the focus is shifted to the other object.

     
    Info

    Once a comment is added to a target element, the

    letter 

    letter (CM)

     is

    is displayed next to the target element. This signifies that a comment has been created for the target element. Refer

    to 

    to Table of

    Suffixes 

    Suffixesfor details on suffixes displayed next to a target element.

    Anchor
    SR
    SR
    Setting Sorting Rules
    You can set sorting rules for a target element. It is used to sort value of elements in the generated output. While generating the output XML, the value of elements can be sorted either in ascending or descending order. For example, records of the employee can be sorted based on their salaries. Figure 551 shows input XML before sorting.

     

    Code Block
    languagexml
    <?xml version="1.0"
     
     encoding="UTF-8"
     
    ?>
     
    -<employees>
    
    -<employee attribute="14"
     
     attribute1="15">
       
    
      <TESTCASENO>TESTCASENO1</TESTCASENO>
       
     
      <DESCRIPTION>DESCRIPTION1</DESCRIPTION>
       
     
      <NAME>John</NAME>
       
     
      <ADDRESS>Address1</ADDRESS>
       
     
      <EMAILID>EMAILID1</EMAILID>
       
     
      <PHONENO>PHONENO1</PHONENO>
       
     
      <DOB>DOB1</DOB>
       
     
      <DEPT>DEPT1</DEPT>
       <SALARY>10000</SALARY>
       
     
      <SALARY>10000</SALARY> 
      <DOJ>DOJ1</DOJ>
       
     
      <DESIGNATION>DESIGNATION1</DESIGNATION>
       <AGE>34</AGE>
       
     
      <AGE>34</AGE> 
      </employee>
    
    -<employee
    attribute="14"
     
     attribute1="15">
       
    
      <TESTCASENO>TESTCASENO2</TESTCASENO>
       
     
      <DESCRIPTION>DESCRIPTION2</DESCRIPTION>
       
     
      <NAME>David</NAME>
       
     
      <ADDRESS>ADDRESS2</ADDRESS>
       
     
      <EMAILID>EMAILID2</EMAILID>
       
     
      <PHONENO>PHONENO2</PHONENO>
       
     
      <DOB>DOB2</DOB>
       
     
      <DEPT>DEPT2</DEPT>
       <SALARY>8000</SALARY>
       
     
      <SALARY>8000</SALARY> 
      <DOJ>DOJ2</DOJ>
       
     
      <DESIGNATION>DESIGNATION2</DESIGNATION>
       <AGE>45</AGE>
       
     
      <AGE>45</AGE> 
      </employee>
    
    -<employee attribute="14"
     
     attribute1="15">
       
    
      <TESTCASENO>TESTCASEN3</TESTCASENO>
       
     
      <DESCRIPTION>DESCRIPTION3</DESCRIPTION>
       
     
      <NAME>Ricky</NAME>
       
     
      <ADDRESS>ADDRESS3</ADDRESS>
       
     
      <EMAILID>EMAILID3</EMAILID>
       
     
      <PHONENO>PHONENO3</PHONENO>
       
     
      <DOB>DOB3</DOB>
       
     
      <DEPT>DEPT3</DEPT>
       <SALARY>15000</SALARY>
       
     
      <SALARY>15000</SALARY> 
      <DOJ>DOJ3</DOJ>
       
     
      <DESIGNATION>DESIGNATION3</DESIGNATION>
       <AGE>36</AGE>
       
     
      <AGE>36</AGE> 
      </employee>
       
    
      </employees>

    Figure 551: Sample Input XML    


    Figure 552 shows the Output XML after sorting.

    Code Block
    language
     
    xml
    <?xml version="1.0"
     
     encoding="UTF-8"
     
    ?>
     
    -<employees xmlns:java="http://xml.apache.org/xslt/java"
     
     xmlns:str="http://exslt.org/strings">
    
    -<employee attribute=""
     
    attribute1="">
       
    
      <TESTCASENO>TESTCASEN3</TESTCASENO>
       
     
      <DESCRIPTION>DESCRIPTION3</DESCRIPTION>
       
     
      <NAME>Ricky</NAME>
       
     
      <ADDRESS>ADDRESS3</ADDRESS>
       
     
      <EMAILID>EMAILID3</EMAILID>
       
     
      <PHONENO>PHONENO3</PHONENO>
       
     
      <DOB>DOB3</DOB>
       
     
      <DEPT>DEPT3</DEPT>
       <SALARY>15000</SALARY>
       
     
      <SALARY>15000</SALARY> 
      <DOJ>DOJ3</DOJ>
       
     
      <DESIGNATION>DESIGNATION3</DESIGNATION>
       <AGE>36</AGE>
       
     
      <AGE>36</AGE> 
      </employee>
    
    -<employee attribute=""
     
     attribute1="">
       
    
      <TESTCASENO>TESTCASENO1</TESTCASENO>
       
     
      <DESCRIPTION>DESCRIPTION1</DESCRIPTION>
       
     
      <NAME>John</NAME>
       
     
      <ADDRESS>Address1</ADDRESS>
       
     
      <EMAILID>EMAILID1</EMAILID>
       
     
      <PHONENO>PHONENO1</PHONENO>
       
     
      <DOB>DOB1</DOB>
       
     
      <DEPT>DEPT1</DEPT>
       <SALARY>10000</SALARY>
       
     
      <SALARY>10000</SALARY> 
      <DOJ>DOJ1</DOJ>
       
     
      <DESIGNATION>DESIGNATION1</DESIGNATION>
       <AGE>34</AGE>
       
     
      <AGE>34</AGE> 
      </employee>
    
    -<employee attribute=""
     
     attribute1="">
       
    
      <TESTCASENO>TESTCASENO2</TESTCASENO>
       
     
      <DESCRIPTION>DESCRIPTION2</DESCRIPTION>
       
     
      <NAME>David</NAME>
       
     
      <ADDRESS>ADDRESS2</ADDRESS>
       
     
      <EMAILID>EMAILID2</EMAILID>
       
     
      <PHONENO>PHONENO2</PHONENO>
       
     
      <DOB>DOB2</DOB>
       
     
      <DEPT>DEPT2</DEPT>
       <SALARY>8000</SALARY>
       
     
      <SALARY>8000</SALARY> 
      <DOJ>DOJ2</DOJ>
       
     
      <DESIGNATION>DESIGNATION2</DESIGNATION>
       <AGE>45</AGE>
       
     
      <AGE>45</AGE> 
      </employee>
       
    
      </employees>
    Figure 552: Output XML

     

     
    Info

    The Sorting rules can be set only for record

    where 

    where For Each Mapping

     or 

    or Apply Template is used.

    The 

    The <xsl:apply-templates>

     element

    element applies a template to the current element or to the child nodes of the current element, when the parent elements of source and target schemas are mapped.

               Figure 552: Output XML

     
    Steps to set Sorting Rules

  1. Ensure that the source and target schemas are loaded and all their elements are listed under their respective nodes.
  2. Ensure that the source and target elements to be mapped are selected and displayed in the Mapping Graph Area.
  3. To use Apply template, click Employee (parent) element in the source panel and drag the mouse pointer to the Employee (parent) element in the target panel. A line is displayed between the source and target panels indicating the mapping between source and target elements (see Figure 553).


    Figure 553: Apply Template

     
    Info

    To learn how to set For Each

    property on

    property on employee element refer to the

    section 

    section Setting For Each Property.

  4. Click the Node tab displayed in the Mapping Graph Area. All tabs of the Node tab are displayed.
  5. Click the Properties tab. The Properties pane is displayed (refer to Figure 548).
  6. Click the Click here to add/view Sorting Rules option displayed against the Sorting property field. This displays the Add New Sorting Rules dialog box (see Figure 554).

    This screen displays the name of the selected target record to be sorted.


    Figure 554: Sorting Rules Dialog Box

  7. Type the name of the source element on the basis of which you want to sort output (e.g. SALARY), in the Source Element field.
  8. Select the data type as either text or numeric from the Data Type dropdown list. This specifies how the input value is to be interpreted. By default, text is selected.
  9. Select the sorting order as ascending or descending from the Order dropdown list. By default, ascending is selected.
  10. Click Save to save the sorting rule.
  11. Click Close to return the Data Mapper screen. The letter (SR) is displayed next to the sorted target element. This signifies that the target element has been sorted based on the specified source element. Refer to the [Table of Suffixes|Using Data Mapper#suffixestable] for details on suffixes displayed next to an element.

     
    Info

    More than one sorting can also be applied to a single target element. For example, if salary of two employees is same, they can be further sorted out based on their age.

     

    To delete sorting,

    click 

    click View/Remove

     button

    button.

    The 

    The Remove Sorting Rules

     dialog

    dialog box is displayed with a list of existing sorting rules. Select sorting rule and

    click 

    click Remove/Remove All

     to delete sorting rules.Once the sorting is applied based on the set rules, the output XML is displayed as displayed in Figure 552

    to delete sorting rules.