This example shows how to map a XML Schema complex type (for example: a repeating element) to a XML Schema simple type (for example: a non-repeating single element). In this example, you will create a transformation that during run time will take a source repeating element and maps it to single target field using constraints as shown in the following figure.
Figure : Repeating Source Group to Non-Repeating Target Element
To Create and Run a Transformation Between a Repeating Source Group and a Non-Repeating Target Element
For this example, import the file: Dates.xsd. If you installed WebLogic Platform in the c:\bea directory, import this file from the c:\bea\weblogic81\workshop\help\doc\en\integration\reffiles\transform\repeatToSingle directory.
Note: The Dates.xsd file used in this example is identical to the Dates.xsd file used in Creating a Transformation Between a Non-Repeating Source Element and Repeating Target Group. If you have already imported the Dates.xsd file for the Creating a Transformation Between a Non-Repeating Source Element and Repeating Target Group example, you do not need to import it again.
For this example, import the file: PODate.xsd. If you installed WebLogic Platform in the c:\bea directory, import this file from the c:\bea\weblogic81\workshop\help\doc\en\integration\reffiles\transform\repeatToSingle directory.
Note: The PODate.xsd file used in this example is identical to the PODate.xsd file used in Creating a Transformation Between a Non-Repeating Source Element and Repeating Target Group. If you have already imported the PODate.xsd file for the Creating a Transformation Between a Non-Repeating Source Element and Repeating Target Group example, you do not need to import it again.
Importing schemas files triggers a build of the current Schemas project folder. Wait until the current Schemas folder is built before proceeding to the next step. (The representations of the schemas will not be available in Available Source Types and Available Target Type panes until build is complete.)
To select an existing method, in the Design View of the Transformation file:
The elements and attributes that make up the Dates.xsd/dates element are displayed in the Selected Source Types pane.
For this example, select the PoDate.xsd/PODate element.
The elements and attributes that make up the PoDate.xsd/PODate element are displayed in the Selected Target Type pane.
The Design View of the XQ file is displayed.
Keep this link selected for the next step.
A dashed line linking the two elements is displayed. The dashed line with short dashes represents a structural link—a link that does not map data directly. The dashed-line representation for a structural link is shown in the following figure.
To learn more about links, see Link Representations.
Warning: You must enter the quotes around the string.
During run time, the constraint created in this step, just tests if constraint: datesDoc/date/type is equal to the string: "BILLING". The next step will add the XQuery code to the for loop to return data if during run time the constraint is equal to true.
During run time, this data link will return the value of datesDoc/date/value as the value of billing-date if the constraint: data($date/ns0:type) = "BILLING" evaluates to true.
A dashed line linking the two elements is displayed.
Keep this link selected for the next step.
Warning: You must enter the quotes around the string.
During run time, the constraint created in step, tests if datesDoc/date/type is equal to the string: "DELIVERY".
During run time, this data link will return the value of datesDoc/date/value as the delivery-date if the constraint: data($date/ns0:type) = "DELIVERY" evaluates to true.
For this example, in the Source Data pane, select the $datesDoc node and import the file: InputDates.xml. If you installed WebLogic Platform in the c:\bea directory, import this file from the c:\bea\weblogic81\workshop\help\doc\en\integration\reffiles\transform\repeatToSingle\XML directory.
Note: You can cut and past directory paths into the Name field of the Open File to Test pane to jump to directory locations. If you installed WebLogic Platform in the c:\bea directory, you can jump to the directory that contains the XML files for this example, by pasting the following directory path into the Name field: c:\bea\weblogic81\workshop\help\doc\en\integration\reffiles\transform\repeatToSingle\XML and then pressing enter.
If not currently running, the WebLogic Server for the current application will be started. In order for a query to run, the WebLogic Server for the current application must be running.
In the Result Data pane, a graphical representation of the target data is displayed.
![]() |
![]() |