User Guide > Using Transformations > Creating an XQuery Transformation
 
Creating an XQuery Transformation
This topic describes how to create an XQuery transformation.
To create an XQuery transformation
1. Have an XML definition set ready. The definition set provides the target schema for the output document.
For details on creating a definition set, see Definition Sets.
2. Select a folder in the Studio resource tree, and then right-click and select New Transformation, or select File > New > Transformation.
3. In the New Transformation window, select XQuery Transformation and click Next.
4. Supply a name for the transformation in the Transformation Name field.
5. Locate and select the XML definition set in the resource tree displayed in the left panel.
6. In the right panel, where all the elements in the XML definition set are displayed:
a. (Optional) Expand the nodes and view the elements to see what is available.
b. Select a top-level element.
This top-level element determines the type and name of the root element in the output XML document.
To have many top-level elements available for selection, use an XML definition set similar to UserSchema, which you can find in Data Services/Web Services/system/admin/
7. Click Finish.
The transformation is added to the resource tree, and its editor opens in the right pane displaying the Model panel by default. The Model panel in the XQuery transformation lets you map source data to the target schema and transform tabular data into XML data.
The following sample entries in the Model panel of an XQuery transformation named InventoryTransactions. Cells that are not appropriate to the transformation are dimmed; the other cells remain white.
8. Use the following sections to complete the definition of this transformation:
Specifying a Target Value
Viewing the Source Scope
Specifying the Source for a Top-Level Element
Specifying Settings for Target Sources in an XQuery Transformation
Specifying Global Input Parameters in an XQuery Transformation
Viewing and Editing the XQuery
Viewing Output Parameters in the XQuery Transformation